Skip to content

Instantly share code, notes, and snippets.

@tpope
Created June 26, 2012 21:26
Show Gist options
  • Save tpope/2999229 to your computer and use it in GitHub Desktop.
Save tpope/2999229 to your computer and use it in GitHub Desktop.
Environment variable overrides in Rails
# Add config/overrides/*.yml to .gitignore
# and this near the top of application.rb
%w(defaults overrides).each do |type|
path = File.expand_path("../#{type}/#{Rails.env}.yml", __FILE__)
ENV.update(YAML.load_file(path)) if File.exist?(path)
end
# For things that are sensitive or developer dependent:
# config/overrides/{development,test}.yml
# For everything else:
# config/defaults/{development,test}.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment