- p. 146 With Rails 6, there’s a new way to handle secrets. Instead of defining
SECRET_KEY_BASE
, you’ll need to defineRAILS_MASTER_KEY
.- Run
bin/rails credentials:edit
and save the result. This will create the value of an encryption key inconfig/master.key
and an encrypted secrets file inconfig/credentials.yml.enc
. - Copy the value of the encryption key in
config/master.key
to theRAILS_MASTER_KEY
environment variable in.env/production/web
. (SECRET_KEY_BASE
is obsolete–don’t define it.)
- Run
3 Likes