To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / lib / tasks / initializers.rake @ 1568:bc47b68a9487
History | View | Annotate | Download (997 Bytes)
| 1 |
desc 'Generates a secret token for the application.'
|
|---|---|
| 2 |
|
| 3 |
file 'config/initializers/secret_token.rb' do |
| 4 |
path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb') |
| 5 |
secret = SecureRandom.hex(40) |
| 6 |
File.open(path, 'w') do |f| |
| 7 |
f.write <<"EOF" |
| 8 |
# This file was generated by 'rake generate_secret_token', and should
|
| 9 |
# not be made visible to public.
|
| 10 |
# If you have a load-balancing Redmine cluster, you will need to use the
|
| 11 |
# same version of this file on each machine. And be sure to restart your
|
| 12 |
# server when you modify this file.
|
| 13 |
#
|
| 14 |
# Your secret key for verifying cookie session data integrity. If you
|
| 15 |
# change this key, all old sessions will become invalid! Make sure the
|
| 16 |
# secret is at least 30 characters and all random, no regular words or
|
| 17 |
# you'll be exposed to dictionary attacks.
|
| 18 |
RedmineApp::Application.config.secret_token = '#{secret}'
|
| 19 |
EOF
|
| 20 |
end
|
| 21 |
end
|
| 22 |
|
| 23 |
desc 'Generates a secret token for the application.'
|
| 24 |
task :generate_secret_token => ['config/initializers/secret_token.rb'] |