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