Allow to specify secret token via environment variable.

This commit is contained in:
Cyril Rohr 2014-04-15 17:57:07 +01:00
parent cad9572ee9
commit b29171d9ec

View file

@ -9,7 +9,9 @@ require 'securerandom'
def find_secure_token def find_secure_token
token_file = Rails.root.join('.secret') token_file = Rails.root.join('.secret')
if File.exist? token_file if ENV.key?('SECRET_KEY_BASE')
ENV['SECRET_KEY_BASE']
elsif File.exist? token_file
# Use the existing token. # Use the existing token.
File.read(token_file).chomp File.read(token_file).chomp
else else