[ rails ] secret file

config/secrets.yml

default: &default
whatever: "whatever"
development:
<<: *default
    secret_key_base: super_long_secret_key_for_development
    active_merchant_login: 896667
    active_merchant_password: supersecretpassword888

test1:
    <<: *default
secret_key_base: super_long_secret_key_for_test
    active_merchant_login: 896667
    active_merchant_password: supersecretpassword888

test2:
<<: *default
    secret_key_base: super_long_secret_key_for_test
    active_merchant_login: 896667
    active_merchant_password: supersecretpassword888

production:
<<: *default
    secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
    active_merchant_login: <%= ENV["AM_LOGIN"] %>
    active_merchant_password: <%= ENV["AM_PASSWORD"] %>
Rails.application.secrets.active_merchant_login
Rails.application.secrets.whatever

NOTE :

Rails.env
Rails.env.production?

ref : https://richonrails.com/articles/the-rails-4-1-secrets-yml-file,

http://stackoverflow.com/questions/2715035/rails-env-vs-rails-env

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s