Chris@0
|
1 desc 'Generates a configuration file for cookie store sessions.'
|
Chris@0
|
2
|
Chris@0
|
3 file 'config/initializers/session_store.rb' do
|
Chris@0
|
4 path = File.join(RAILS_ROOT, 'config', 'initializers', 'session_store.rb')
|
Chris@0
|
5 secret = ActiveSupport::SecureRandom.hex(40)
|
Chris@0
|
6 File.open(path, 'w') do |f|
|
Chris@0
|
7 f.write <<"EOF"
|
Chris@0
|
8 # This file was generated by 'rake config/initializers/session_store.rb',
|
Chris@0
|
9 # and should not be made visible to public.
|
Chris@0
|
10 # If you have a load-balancing Redmine cluster, you will need to use the
|
Chris@0
|
11 # same version of this file on each machine. And be sure to restart your
|
Chris@0
|
12 # server when you modify this file.
|
Chris@0
|
13
|
Chris@0
|
14 # Your secret key for verifying cookie session data integrity. If you
|
Chris@0
|
15 # change this key, all old sessions will become invalid! Make sure the
|
Chris@0
|
16 # secret is at least 30 characters and all random, no regular words or
|
Chris@0
|
17 # you'll be exposed to dictionary attacks.
|
Chris@0
|
18 ActionController::Base.session = {
|
chris@37
|
19 :key => '_redmine_session',
|
Chris@0
|
20 #
|
Chris@0
|
21 # Uncomment and edit the :session_path below if are hosting your Redmine
|
Chris@0
|
22 # at a suburi and don't want the top level path to access the cookies
|
Chris@0
|
23 #
|
Chris@0
|
24 # See: http://www.redmine.org/issues/3968
|
Chris@0
|
25 #
|
Chris@0
|
26 # :session_path => '/url_path_to/your/redmine/',
|
Chris@0
|
27 :secret => '#{secret}'
|
Chris@0
|
28 }
|
Chris@0
|
29 EOF
|
Chris@0
|
30 end
|
Chris@0
|
31 end
|
Chris@0
|
32
|
Chris@0
|
33 desc 'Generates a configuration file for cookie store sessions.'
|
Chris@0
|
34 task :generate_session_store => ['config/initializers/session_store.rb']
|