Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails environment variables vs Rails 5.2 credentials

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?

like image 584
stcho Avatar asked Mar 04 '19 17:03

stcho


1 Answers

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.

like image 80
Brandon Avatar answered Oct 26 '22 13:10

Brandon