Posts

Showing posts with the label credentials

Rails multi environment credentials

Image
Background Generally in applications there are various secrets and credentials, that we need to make use of like API keys, secrets, etc. For such secrets we need the ability to conveniently and securely manage credentials. Rails 5.1 added  a feature  to use secrets to manage credentials. Rails 5.2 replaced secrets with credentials, since encrypted and un-encrypted secrets were making it harder to manage them. A set of files were used to manage these credentials: config/credentials.yml.enc config/master.key config/credentials.yml.enc  is an encrypted file which store the credentials. As this is a encrypted file, we can safely commit it to our version control systems. config/master.key  contains  RAILS_MASTER_KEY  which is used to decrypt the  config/credentials.yml.enc .  We should not commit this file to version control . Interacting with credentials As  config/credentials.yml.enc  is encrypted we should never directly read from or write...