Rails environment variables vs Rails 5.2 credentials

stc*_*cho 5 ruby-on-rails ruby-on-rails-5.2

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?

Bra*_*don 2

凭证存储在加密文件中并签入您的存储库。有一个主密钥文件充当开发中的密钥,并且您将主密钥文件的值设置为生产中的环境变量,并且两个环境都可以访问凭据。另一方面,环境变量应该用于非秘密的值。不过,环境变量通常不会签入您的存储库。