Commit 52a247da5ec279ae2aa2113b9157be36f5eb812f
Exists in
spb-stable
and in
3 other branches
Merge pull request #6783 from pkgr/allow-secret-token-env
Allow to specify secret token via SECRET_KEY_BASE environment variable.
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
config/initializers/secret_token.rb
@@ -9,7 +9,9 @@ require 'securerandom' | @@ -9,7 +9,9 @@ require 'securerandom' | ||
9 | 9 | ||
10 | def find_secure_token | 10 | def find_secure_token |
11 | token_file = Rails.root.join('.secret') | 11 | token_file = Rails.root.join('.secret') |
12 | - if File.exist? token_file | 12 | + if ENV.key?('SECRET_KEY_BASE') |
13 | + ENV['SECRET_KEY_BASE'] | ||
14 | + elsif File.exist? token_file | ||
13 | # Use the existing token. | 15 | # Use the existing token. |
14 | File.read(token_file).chomp | 16 | File.read(token_file).chomp |
15 | else | 17 | else |