Commit f53baa7c4c4139e0f3c323a6da02e80e925d611f

Authored by Cyril Mougel
1 parent 7d761348
Exists in master and in 1 other branch production

Avoid to advice delete the config/initializer/secret_token.rb

In the file config/initializer/secret_token.rb, there are an advice to
replace this file by a generate file. It's better to avoid it and
generate a new one instead require before this one

See #580
config/deploy.example.rb
... ... @@ -69,7 +69,7 @@ namespace :errbit do
69 69 release_configs = File.join(release_path,'config')
70 70 run("ln -nfs #{shared_configs}/config.yml #{release_configs}/config.yml")
71 71 run("ln -nfs #{shared_configs}/mongoid.yml #{release_configs}/mongoid.yml")
72   - run("ln -nfs #{shared_configs}/secret_token.rb #{release_configs}/initializers/secret_token.rb")
  72 + run("ln -nfs #{shared_configs}/secret_token.rb #{release_configs}/initializers/__secret_token.rb")
73 73 end
74 74 end
75 75  
... ...
config/initializers/secret_token.rb
... ... @@ -14,7 +14,7 @@ else
14 14 Errbit::Application.config.secret_token = ENV['SECRET_TOKEN']
15 15  
16 16 # Do not raise an error if secret token is not available during assets precompilation
17   - elsif ENV['RAILS_GROUPS'] != 'assets'
  17 + elsif ENV['RAILS_GROUPS'] != 'assets' && !Errbit::Application.config.secret_token
18 18 raise <<-ERROR
19 19  
20 20 You must generate a unique secret token for your Errbit instance.
... ... @@ -27,9 +27,9 @@ else
27 27 heroku config:add SECRET_TOKEN="$(bundle exec rake secret)"
28 28  
29 29 If you are deploying in some other way, please run the following command to generate a new secret token,
30   - and commit the new `config/initializers/secret_token.rb`:
  30 + and commit the new `config/initializers/__secret_token.rb`:
31 31  
32   - echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/secret_token.rb
  32 + echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/__secret_token.rb
33 33  
34 34 ERROR
35 35 end
... ...