To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / ac / ac80a0a0728af94588c2f8cce1549e26340e25ff.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (997 Bytes)
| 1 | 1296:038ba2d95de8 | Chris | 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'] |