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