Skip to content

Commit

Permalink
Avoid to advice delete the config/initializer/secret_token.rb
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shingara committed Oct 11, 2013
1 parent 7d76134 commit f53baa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/deploy.example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
release_configs = File.join(release_path,'config')
run("ln -nfs #{shared_configs}/config.yml #{release_configs}/config.yml")
run("ln -nfs #{shared_configs}/mongoid.yml #{release_configs}/mongoid.yml")
run("ln -nfs #{shared_configs}/secret_token.rb #{release_configs}/initializers/secret_token.rb")
run("ln -nfs #{shared_configs}/secret_token.rb #{release_configs}/initializers/__secret_token.rb")
end
end

Expand Down
6 changes: 3 additions & 3 deletions config/initializers/secret_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Errbit::Application.config.secret_token = ENV['SECRET_TOKEN']

# Do not raise an error if secret token is not available during assets precompilation
elsif ENV['RAILS_GROUPS'] != 'assets'
elsif ENV['RAILS_GROUPS'] != 'assets' && !Errbit::Application.config.secret_token
raise <<-ERROR
You must generate a unique secret token for your Errbit instance.
Expand All @@ -27,9 +27,9 @@
heroku config:add SECRET_TOKEN="$(bundle exec rake secret)"
If you are deploying in some other way, please run the following command to generate a new secret token,
and commit the new `config/initializers/secret_token.rb`:
and commit the new `config/initializers/__secret_token.rb`:
echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/secret_token.rb
echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/__secret_token.rb
ERROR
end
Expand Down

0 comments on commit f53baa7

Please sign in to comment.