Chris@909: desc 'Generates a configuration file for cookie store sessions.' Chris@909: Chris@909: file 'config/initializers/session_store.rb' do Chris@909: path = File.join(Rails.root, 'config', 'initializers', 'session_store.rb') Chris@909: secret = ActiveSupport::SecureRandom.hex(40) Chris@909: File.open(path, 'w') do |f| Chris@909: f.write <<"EOF" Chris@909: # This file was generated by 'rake config/initializers/session_store.rb', Chris@909: # and should not be made visible to public. Chris@909: # If you have a load-balancing Redmine cluster, you will need to use the Chris@909: # same version of this file on each machine. And be sure to restart your Chris@909: # server when you modify this file. Chris@909: Chris@909: # Your secret key for verifying cookie session data integrity. If you Chris@909: # change this key, all old sessions will become invalid! Make sure the Chris@909: # secret is at least 30 characters and all random, no regular words or Chris@909: # you'll be exposed to dictionary attacks. Chris@909: ActionController::Base.session = { Chris@909: :key => '_redmine_session', Chris@909: # Chris@909: # Uncomment and edit the :session_path below if are hosting your Redmine Chris@909: # at a suburi and don't want the top level path to access the cookies Chris@909: # Chris@909: # See: http://www.redmine.org/issues/3968 Chris@909: # Chris@909: # :session_path => '/url_path_to/your/redmine/', Chris@909: :secret => '#{secret}' Chris@909: } Chris@909: EOF Chris@909: end Chris@909: end Chris@909: Chris@909: desc 'Generates a configuration file for cookie store sessions.' Chris@909: task :generate_session_store => ['config/initializers/session_store.rb']