-
-
Save asssis/fb03d8469126de8f42c7f96bb2db53f9 to your computer and use it in GitHub Desktop.
Rails 5.2 Credentials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Edit credentials | |
EDITOR=nano rails credentials:edit | |
# Generate Random key | |
rails secret | |
# Use Example on Devise | |
development: | |
devise_key: <dev-key> | |
production: | |
devise_key: <prod-key> | |
config.secret_key = Rails.application.credentials[Rails.env.to_sym][:devise_key] | |
Rails.application.credentials.aws[:access_key_id] # => "123" | |
Rails.application.credentials.aws[:secret_access_key] # => "345" | |
Rails.application.credentials.secret_key_base # => "2fdea... | |
# Uncomment in environments/production.rb this line: | |
config.require_master_key = true | |
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] | |
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files). | |
config.require_master_key = true | |
# If lost the master.key just delete credentials.yml.enc and execute EDITOR=nano rails credentials:edit the Rails will generate anothers files. | |
# References | |
https://medium.com/cedarcode/rails-5-2-credentials-9b3324851336 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment