Chris@1295: desc 'Generates a secret token for the application.' Chris@1295: Chris@1295: file 'config/initializers/secret_token.rb' do Chris@1295: path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb') Chris@1295: secret = SecureRandom.hex(40) Chris@1295: File.open(path, 'w') do |f| Chris@1295: f.write <<"EOF" Chris@1295: # This file was generated by 'rake generate_secret_token', and should Chris@1295: # not be made visible to public. Chris@1295: # If you have a load-balancing Redmine cluster, you will need to use the Chris@1295: # same version of this file on each machine. And be sure to restart your Chris@1295: # server when you modify this file. Chris@1295: # Chris@1295: # Your secret key for verifying cookie session data integrity. If you Chris@1295: # change this key, all old sessions will become invalid! Make sure the Chris@1295: # secret is at least 30 characters and all random, no regular words or Chris@1295: # you'll be exposed to dictionary attacks. Chris@1295: RedmineApp::Application.config.secret_token = '#{secret}' Chris@1295: EOF Chris@1295: end Chris@1295: end Chris@1295: Chris@1295: desc 'Generates a secret token for the application.' Chris@1295: task :generate_secret_token => ['config/initializers/secret_token.rb']