Rails 6 adds support for multi environment credentials. Rails 5.2 includes encrypted credentials for Rails applications.
Rails 5.1 had introduced a feature of secret management in Rails applications It has been evolved and renamed since then to encrypted credentials. But, it had support to have single encrypted credentials file.
Now, we can have environment specific credentials with Rails 6.
Add new environment credentials
To add credentials for a
we can run the command given below.
This will create a file
- Rails will detect environment specific credentials file based on the file format given above
- Environment specific file will take precedence over default
Support in Rails 5.2
We can still support environment specific credentials
older Rails application.
in a Github comment,
we can override
on Rails application to achieve this.
As we can see, this uses default credentials file
if the Rails environment is
It uses environment specific encrypted file if the environment
is non production environment.
- Pull Request: Add support for multi environment credentials.
Subscribe to Ruby in Rails
Get the latest posts delivered right to your inbox