Skip to content

Commit f55306f

Browse files
committed
[ci skip] Improve encrypted commands USAGE
This streamlines the lovely foundation Bogdan added. Mainly to add guidance around encryption keys and remove some backticks. Finally it adds some mention of how to access these files from Ruby in apps. [ Kasper Timm Hansen & bogdanvlviv ]
1 parent 7874257 commit f55306f

File tree

1 file changed

+19
-13
lines changed
  • railties/lib/rails/commands/encrypted

1 file changed

+19
-13
lines changed
Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
=== Storing Encrypted Files in Source Control
22

3-
The Rails `encrypted` commands provide access to encrypted files.
3+
The Rails `encrypted` commands provide access to encrypted files or configurations.
4+
See the `Rails.application.encrypted` documentation for using them in your app.
5+
6+
=== Encryption Keys
7+
8+
By default, Rails looks for the encryption key in `config/master.key` or
9+
`ENV["RAILS_MASTER_KEY"]`, but that lookup can be overriden with `--key`:
10+
11+
rails encrypted:edit config/encrypted_file.yml.enc --key config/encrypted_file.key
12+
13+
Don't commit the key! Add it to your source control's ignore file. If you use
14+
Git, Rails handles this for you.
415

516
=== Editing Files
617

7-
`rails encrypted:edit config/encrypted_file.yml.enc` opens a temporary file
8-
in `$EDITOR` with the decrypted contents of `config/encrypted_file.yml.enc` to
9-
edit. The encrypted key is either stored in `config/master.key`
10-
or `ENV["RAILS_MASTER_KEY"]` is used, but you can provide relative path
11-
to the encryption key by using `--key` option:
18+
To edit or create an encrypted file use:
19+
20+
rails encrypted:edit config/encrypted_file.yml.enc
1221

13-
`rails encrypted:edit config/encrypted_file.yml.enc --key config/encrypted_file.key`.
22+
This opens a temporary file in `$EDITOR` with the decrypted contents for editing.
1423

15-
=== Viewing files
24+
=== Viewing Files
1625

17-
`rails encrypted:show config/encrypted_file.yml.enc` prints the decrypted contents of
18-
`config/encrypted_file.yml.enc` file. The encrypted key is either stored in `config/master.key`
19-
or `ENV["RAILS_MASTER_KEY"]` is used, but you can provide relative path
20-
to the encryption key by using `--key` option:
26+
To print the decrypted contents of an encrypted file use:
2127

22-
`rails encrypted:show config/encrypted_file.yml.enc --key config/encrypted_file.key`.
28+
rails encrypted:show config/encrypted_file.yml.enc

0 commit comments

Comments
 (0)