ENV['foo']
# nil
ENV.fetch('foo')
# Raises KeyError (key not found: "foo")
ENV.fetch('foo', :default_need_not_be_a_string)
# => :default_need_not_be_a_string
ENV['foo'] = '123'
ENV['foo']
# => '123'
ENV.fetch('foo')
# => '123'
ENV.fetch('foo', :default_need_not_be_a_string)
# => '123'
# add to Gemfile
gem "figaro"
# run
bundle install
bundle exec figaro install
# => generate `config/application.yml`
# Ex: https://github.com/laserlemon/figaro
MAIL_USERNAME: 'Your_Username' MAIL_PASSWORD: 'Your_Username'