using env in rails code example
Example 1: ruby on rails set environment variables example
MAIL_USERNAME: 'Your_Username' MAIL_PASSWORD: 'Your_Username'
Example 2: ruby on rails set environment variables example
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