Advertisement
Guest User

Untitled

a guest
Jun 14th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. module EnvironmentVariablesExample
  2. class Application < Rails::Application
  3. config.before_configuration do
  4. env_file = Rails.root.join("config", 'environment_variables.yml').to_s
  5.  
  6. if File.exists?(env_file)
  7. YAML.load_file(env_file)[Rails.env].each do |key, value|
  8. ENV[key.to_s] = value
  9. end # end YAML.load_file
  10. end # end if File.exists?
  11. end # end config.before_configuration
  12. end # end class
  13. end # end module
  14.  
  15. # environment_variables.yml
  16. # development:
  17. # GMAIL_USERNAME: myemail@gmail.com
  18. # GMAIL_PASSWORD: monkey123
  19. # production:
  20. # GMAIL_USERNAME: myemail@mydomain.com
  21. # GMAIL_PASSWORD: myproductionpassword123
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement