Sha256: b2a4fed0d4489f4822df9768829fbf9ff44446f0ea4c3cae2ca3dda52ce08eee

Contents?: true

Size: 1.68 KB

Versions: 42

Compression:

Stored size: 1.68 KB

Contents

=== Storing Encrypted Credentials in Source Control

The Rails `credentials` commands provide access to encrypted credentials,
so you can safely store access tokens, database passwords, and the like
safely inside the app without relying on a mess of ENVs.

This also allows for atomic deploys: no need to coordinate key changes
to get everything working as the keys are shipped with the code.

=== Setup

Applications after Rails 5.2 automatically have a basic credentials file generated
that just contains the secret_key_base used by MessageVerifiers/MessageEncryptors, like the ones
signing and encrypting cookies.

For applications created prior to Rails 5.2, we'll automatically generate a new
credentials file in `config/credentials.yml.enc` the first time you run `bin/rails credentials:edit`.
If you didn't have a master key saved in `config/master.key`, that'll be created too.

Don't lose this master key! Put it in a password manager your team can access.
Should you lose it no one, including you, will be able to access any encrypted
credentials.

Don't commit the key! Add `config/master.key` to your source control's
ignore file. If you use Git, Rails handles this for you.

Rails also looks for the master key in `ENV["RAILS_MASTER_KEY"]`, if that's easier to manage.

You could prepend that to your server's start command like this:

   RAILS_MASTER_KEY="very-secret-and-secure" server.start

=== Editing Credentials

This will open a temporary file in `$EDITOR` with the decrypted contents to edit
the encrypted credentials.

When the temporary file is next saved the contents are encrypted and written to
`config/credentials.yml.enc` while the file itself is destroyed to prevent credentials
from leaking.

Version data entries

42 entries across 42 versions & 3 rubygems

Version Path
railties-5.2.8.1 lib/rails/commands/credentials/USAGE
railties-5.2.8 lib/rails/commands/credentials/USAGE
railties-5.2.7.1 lib/rails/commands/credentials/USAGE
railties-5.2.7 lib/rails/commands/credentials/USAGE
railties-5.2.6.3 lib/rails/commands/credentials/USAGE
railties-5.2.6.2 lib/rails/commands/credentials/USAGE
railties-5.2.6.1 lib/rails/commands/credentials/USAGE
railties-5.2.6 lib/rails/commands/credentials/USAGE
railties-5.2.4.6 lib/rails/commands/credentials/USAGE
railties-5.2.5 lib/rails/commands/credentials/USAGE
railties-5.2.4.5 lib/rails/commands/credentials/USAGE
railties-5.2.4.4 lib/rails/commands/credentials/USAGE
railties-5.2.4.3 lib/rails/commands/credentials/USAGE
railties-5.2.4.2 lib/rails/commands/credentials/USAGE
railties-5.2.4.1 lib/rails/commands/credentials/USAGE
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/credentials/USAGE
railties-5.2.4 lib/rails/commands/credentials/USAGE
railties-5.2.4.rc1 lib/rails/commands/credentials/USAGE
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/credentials/USAGE
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/credentials/USAGE