I just wanted to know what the specific differentiation is between

environment variables ENV[SOME_VARIABLE]

vs.

Rails 5.2 credentials Rails.application.credentials.some_variable

When should I use one vs. the other? Did the credentials replace the env variables?

1 Answers

0
Brandon On

Credentials are stored in an encrypted file and are checked into your repository. There is a master key file that acts as the key in development, and you set the value of the master key file as an environment variable in production and both environments have access to the credentials. environment variables, on the other hand, should be used for values which are not secrets. Environment variables are generally not checked into your repository though still.