Skip to content

Instantly share code, notes, and snippets.

@rafaelcgo
Created February 25, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelcgo/d0ec3395f4ff9fe75a1b to your computer and use it in GitHub Desktop.
Save rafaelcgo/d0ec3395f4ff9fe75a1b to your computer and use it in GitHub Desktop.
Rails loading config from yaml
config.before_configuration do
env_file = File.join(Rails.root, 'config', 'local_env.yml')
YAML.load(File.open(env_file)).each do |key, value|
ENV[key.to_s] = value
end if File.exists?(env_file)
end
@banduk
Copy link

banduk commented Feb 25, 2015

if File.exists?(File.expand_path('../application.yml', __FILE__))
    config.settings = YAML.load(ERB.new(File.read(File.expand_path('../application.yml', __FILE__))).result)[Rails.env].symbolize_keys
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment