Skip to content

Commit

Permalink
Implemented ability to have a box.override.yml to override values in …
Browse files Browse the repository at this point in the history
…box.yml
  • Loading branch information
sebbaum committed Oct 30, 2020
1 parent afb7929 commit dd9fef5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
*.log
**/index.nginx-debian.html
configure/box.yml
**/box.override.yml
extra
24 changes: 21 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "erb"

# Get and print version information
VBOX_VERSION = File.read("VERSION")
puts "Vbox #{VBOX_VERSION}"
puts "-> Vbox #{VBOX_VERSION}"

########################################################################################################################
# Load the box configuration
Expand All @@ -24,10 +24,28 @@ if (configPath.nil?)
end

configure = YAML.load_file(configPath)
puts "Used box configuration: #{configPath}"
puts "-> Used box configuration: #{configPath}"

########################################################################################################################
# Generate configs
# Override box configuration with individual per developer configuratins.
########################################################################################################################
externalOverride = File.join(__dir__, "..", "box.override.yml")
internalOverride = File.join(__dir__, "box.override.yml")
nestedOverride = File.join(__dir__, "configure", "box.override.yml")
overridePath = nestedOverride if (File.exist?(nestedOverride))
overridePath = internalOverride if (File.exist?(internalOverride))
overridePath = externalOverride if (File.exist?(externalOverride))

if (overridePath.nil?)
puts "-> No override of box.yml is provided."
else
configOverrides = YAML.load_file(overridePath)
configure.merge!(configOverrides)
puts "-> Overriding box.yml configuration with values from #{overridePath}."
end

########################################################################################################################
# Generate webserver configs
########################################################################################################################
vars = configure
nginxConf = ERB.new File.read("provisioning/templates/nginx/nginx-default.conf.erb")
Expand Down

0 comments on commit dd9fef5

Please sign in to comment.