Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module EnvironmentVariablesExample
- class Application < Rails::Application
- config.before_configuration do
- env_file = Rails.root.join("config", 'environment_variables.yml').to_s
- if File.exists?(env_file)
- YAML.load_file(env_file)[Rails.env].each do |key, value|
- ENV[key.to_s] = value
- end # end YAML.load_file
- end # end if File.exists?
- end # end config.before_configuration
- end # end class
- end # end module
- # environment_variables.yml
- # development:
- # GMAIL_USERNAME: myemail@gmail.com
- # GMAIL_PASSWORD: monkey123
- # production:
- # GMAIL_USERNAME: myemail@mydomain.com
- # GMAIL_PASSWORD: myproductionpassword123
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement