How to store credentials and secrets in Ruby on Rails 6
Ruby on Rails has a support for storing credentials and secrets with rails credentials:edit
- Rails 5.1 introduced
secrets
https://github.com/rails/rails/pull/28038 - Rails 5.2 replaced
secrets
withcredentials
https://github.com/rails/rails/pull/30067 - Rails 6. added support for multi environment credentials https://github.com/rails/rails/pull/33521
export EDITOR="code --wait" # or export EDITOR=vim
# Create global credentials at config/credentials.yml.enc and config/master.key
rails credentials:edit
# Create credentials for a given environment at config/credentials/<environment>.yml.enc
# It takes precedence over global credentials
rails credentials:edit --environment production
rails credentials:edit --environment development
Follow my journey trying to bootstrap a side business.
Powered by
EmailOctopus