diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
index 98400290113acb77ee820b20098c702d6724796e..62a54bc8c63274b546eb70bdbafbfb6633cb682c 100644
--- a/config/initializers/secret_token.rb
+++ b/config/initializers/secret_token.rb
@@ -9,7 +9,9 @@ require 'securerandom'
 
 def find_secure_token
   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.
     File.read(token_file).chomp
   else