Commit eef21e8147864c43d9e6e4ead76a73c19ae56a0a
1 parent
6a64e048
Exists in
master
and in
1 other branch
Be sure a secret_token is define in RAILS_GROUP == 'assets'
This case is need to avoid failure on rake assets:precompile if no ENV are define like in heroku See #461
Showing
1 changed file
with
6 additions
and
9 deletions
Show diff stats
config/initializers/secret_token.rb
@@ -6,16 +6,14 @@ | @@ -6,16 +6,14 @@ | ||
6 | # no regular words or you'll be exposed to dictionary attacks. | 6 | # no regular words or you'll be exposed to dictionary attacks. |
7 | 7 | ||
8 | # Everyone can share the same token for development/test | 8 | # Everyone can share the same token for development/test |
9 | -if %w(development test).include? Rails.env | ||
10 | - Errbit::Application.config.secret_token = 'f258ed69266dc8ad0ca79363c3d2f945c388a9c5920fc9a1ae99a98fbb619f135001c6434849b625884a9405a60cd3d50fc3e3b07ecd38cbed7406a4fccdb59c' | ||
11 | -else | ||
12 | - | ||
13 | - if ENV['SECRET_TOKEN'].present? | ||
14 | - Errbit::Application.config.secret_token = ENV['SECRET_TOKEN'] | 9 | +if ENV['SECRET_TOKEN'].present? |
10 | + Errbit::Application.config.secret_token = ENV['SECRET_TOKEN'] | ||
15 | 11 | ||
16 | # Do not raise an error if secret token is not available during assets precompilation | 12 | # Do not raise an error if secret token is not available during assets precompilation |
17 | - elsif ENV['RAILS_GROUPS'] != 'assets' && !Errbit::Application.config.secret_token | ||
18 | - raise <<-ERROR | 13 | +elsif %w(development test).include?(Rails.env) || ENV['RAILS_GROUPS'] == 'assets' |
14 | + Errbit::Application.config.secret_token = 'f258ed69266dc8ad0ca79363c3d2f945c388a9c5920fc9a1ae99a98fbb619f135001c6434849b625884a9405a60cd3d50fc3e3b07ecd38cbed7406a4fccdb59c' | ||
15 | +elsif !Errbit::Application.config.secret_token | ||
16 | + raise <<-ERROR | ||
19 | 17 | ||
20 | You must generate a unique secret token for your Errbit instance. | 18 | You must generate a unique secret token for your Errbit instance. |
21 | 19 | ||
@@ -32,7 +30,6 @@ else | @@ -32,7 +30,6 @@ else | ||
32 | echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/__secret_token.rb | 30 | echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/__secret_token.rb |
33 | 31 | ||
34 | ERROR | 32 | ERROR |
35 | - end | ||
36 | end | 33 | end |
37 | 34 | ||
38 | Devise.secret_key = Errbit::Application.config.secret_token | 35 | Devise.secret_key = Errbit::Application.config.secret_token |