From d69b04de0ff33237209afea6f6cac3ab27934908 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 20 Sep 2018 11:08:18 +0900 Subject: Fix env name for master key When using environment specific credentials, `RAILS_MASTER_KEY` is not used. --- railties/CHANGELOG.md | 2 +- railties/lib/rails/application.rb | 2 +- railties/lib/rails/commands/credentials/USAGE | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'railties') 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 ENV["RAILS_MASTER_KEY"] or from loading +config/credentials/production.key+. + # from ENV["RAILS_PRODUCTION_KEY"] 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`. -- cgit v1.2.3