|
1 | 1 | === Storing Encrypted Files in Source Control
|
2 | 2 |
|
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. |
4 | 15 |
|
5 | 16 | === Editing Files
|
6 | 17 |
|
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 |
12 | 21 |
|
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. |
14 | 23 |
|
15 |
| -=== Viewing files |
| 24 | +=== Viewing Files |
16 | 25 |
|
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: |
21 | 27 |
|
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