openstreetmap-website/config/preinitializer.rb
John Firebaugh c4edac9fd8 Always run tests using example.application.yml
This fixes an Oauth integration test failure when a
custom application.yml is present.
2013-08-01 17:26:48 +01:00

16 lines
424 B
Ruby

require 'yaml'
env = ENV['RAILS_ENV'] || 'development'
config = YAML.load_file(File.expand_path(env == "test" ? "../example.application.yml" : "../application.yml", __FILE__))
ENV.each do |key,value|
if key.match(/^OSM_(.*)$/)
Object.const_set(Regexp.last_match(1).upcase, value)
end
end
config[env].each do |key,value|
unless Object.const_defined?(key.upcase)
Object.const_set(key.upcase, value)
end
end