Create Environment Specific Rails Credentials
If you've worked with the rails encrypted credentials system before, you're probably familiar with the command to edit them
bin/rails credentials:edit
This will create(if it doesn't exist config/credentials.yml.enc
by way of the RAILS_MASTER_KEY). If you only have this credentials file, the items in this file will be available to all environments of your application.
But you can also create/edit environment specific credentials by specifying an environment. This will similarly create 2 files - config/development.key
and config/development.yml.enc
.
bin/rails credentials:edit --environment development
Credentials specified in this file will only be available in the development environment
https://edgeguides.rubyonrails.org/security.html#custom-credentials
Tweet