secret_token.rb
1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# Everyone can share the same token for development/test
if %w(development test).include? Rails.env
Errbit::Application.config.secret_token = 'f258ed69266dc8ad0ca79363c3d2f945c388a9c5920fc9a1ae99a98fbb619f135001c6434849b625884a9405a60cd3d50fc3e3b07ecd38cbed7406a4fccdb59c'
else
if ENV['SECRET_TOKEN'].present?
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'
raise <<-ERROR
You must generate a unique secret token for your Errbit instance.
If you are deploying via capistrano, please ensure that your `config/deploy.rb` contains
the new `errbit:setup_configs` and `errbit:symlink_configs` tasks from `config/deploy.example.rb`.
Next time you deploy, your secret token will be automatically generated.
If you are deploying to Heroku, please run the following command to set your secret token:
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`:
echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/secret_token.rb
ERROR
end
end
Devise.secret_key = Errbit::Application.config.secret_token