Skip to content

Commit

Permalink
Merge pull request #360 from phuonglm/support-project-base-config
Browse files Browse the repository at this point in the history
should implement project specific config support feature #321; fix bug
  • Loading branch information
hoatle authored Jul 21, 2017
2 parents c0b147a + f735426 commit b5fffc0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,20 @@ begin
end
end


if data_hash['vagrant'] && data_hash['vagrant']['config_paths']
data_hash['vagrant']['config_paths'].map do |default_config_file_path|
overide_config_file_path = default_config_file_path.gsub(/default\.json$/, "overide.json")
if File.exist?(default_config_file_path)
default_config_file = File.read(default_config_file_path)

if File.exist?(File.dirname(__FILE__) + '/' + default_config_file_path)
default_config_file = File.read(File.dirname(__FILE__) + '/' + default_config_file_path)
parsing_file = default_config_file_path
project_config_hash = JSON.parse(default_config_file)
else
puts red('Error read file ' + default_config_file_path + '. Please check if that file exist. Exiting.' )
exit!
puts "[teracy-dev][INFO]: #{default_config_file_path} not found, make sure this is intended."
end

if File.exist?(overide_config_file_path)
override_config_file = File.read(overide_config_file_path)
if File.exist?(File.dirname(__FILE__) + '/' + overide_config_file_path)
override_config_file = File.read(File.dirname(__FILE__) + '/' + overide_config_file_path)
parsing_file = overide_config_file_path
overide_config_hash = JSON.parse(override_config_file)
project_config_hash = overrides(project_config_hash, overide_config_hash)
Expand All @@ -72,7 +71,6 @@ rescue Exception => msg
end
end


Vagrant.configure("2") do |config|

vm_hash = data_hash["vm"]
Expand Down

0 comments on commit b5fffc0

Please sign in to comment.