aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-09-20 11:08:18 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-09-20 11:08:18 +0900
commitd69b04de0ff33237209afea6f6cac3ab27934908 (patch)
treeaefa7963aba6b0244e940bc847ce08a2c45bea25
parent12c2dab41b86331c155c72a9c003826ea487a079 (diff)
downloadrails-d69b04de0ff33237209afea6f6cac3ab27934908.tar.gz
rails-d69b04de0ff33237209afea6f6cac3ab27934908.tar.bz2
rails-d69b04de0ff33237209afea6f6cac3ab27934908.zip
Fix env name for master key
When using environment specific credentials, `RAILS_MASTER_KEY` is not used.
-rw-r--r--railties/CHANGELOG.md2
-rw-r--r--railties/lib/rails/application.rb2
-rw-r--r--railties/lib/rails/commands/credentials/USAGE2
3 files changed, 3 insertions, 3 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index 691e599ddb..2a11f7ddab 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,7 +1,7 @@
* Support environment specific credentials file.
For `production` environment look first for `config/credentials/production.yml.enc` file that can be decrypted by
- `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key` master key.
+ `ENV["RAILS_PRODUCTION_KEY"]` or `config/credentials/production.key` master key.
Edit given environment credentials file by command `rails credentials:edit --environment production`.
Default paths can be overwritten by setting `config.credentials.content_path` and `config.credentials.key_path`.
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 656786246d..3cc5b70e9e 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -440,7 +440,7 @@ module Rails
# +config/master.key+.
# If specific credentials file exists for current environment, it takes precedence, thus for +production+
# environment look first for +config/credentials/production.yml.enc+ with master key taken
- # from <tt>ENV["RAILS_MASTER_KEY"]</tt> or from loading +config/credentials/production.key+.
+ # from <tt>ENV["RAILS_PRODUCTION_KEY"]</tt> or from loading +config/credentials/production.key+.
# Default behavior can be overwritten by setting +config.credentials.content_path+ and +config.credentials.key_path+.
def credentials
@credentials ||= encrypted(config.credentials.content_path, key_path: config.credentials.key_path)
diff --git a/railties/lib/rails/commands/credentials/USAGE b/railties/lib/rails/commands/credentials/USAGE
index 6b33d1ab74..513afcbc78 100644
--- a/railties/lib/rails/commands/credentials/USAGE
+++ b/railties/lib/rails/commands/credentials/USAGE
@@ -43,7 +43,7 @@ from leaking.
It is possible to have credentials for each environment. If the file for current environment exists it will take
precedence over `config/credentials.yml.enc`, thus for `production` environment first look for
-`config/credentials/production.yml.enc` that can be decrypted using master key taken from `ENV["RAILS_MASTER_KEY"]`
+`config/credentials/production.yml.enc` that can be decrypted using master key taken from `ENV["RAILS_PRODUCTION_KEY"]`
or stored in `config/credentials/production.key`.
To edit given file use command `rails credentials:edit --environment production`
Default paths can be overwritten by setting `config.credentials.content_path` and `config.credentials.key_path`.