Set ENV variables for Ruby on Rails
for what you use config/application.yml instead use config/secrets.yml. It is already implemented in Rails. Than you can fetch your key by:

Rails.application.secrets


even more, add to config/application.rb variable SECRETS = Rails.application.secrets and now you can use it:

SECRETS[:my_secret_key]


read more IN RAILS DOCS