[DRE-commits] [SCM] redmine.git branch, master-experimental, updated. debian/1.4.4+dfsg1-1-12-g70fca02
Ondřej Surý
ondrej at sury.org
Sun Oct 14 18:31:20 UTC 2012
The following commit has been merged in the master-experimental branch:
commit 70fca02b1baf29143831a633b6f04b380dfba8af
Author: Ondřej Surý <ondrej at sury.org>
Date: Sun Oct 14 20:30:35 2012 +0200
Update externalize session config patch to redmine 2.1
diff --git a/debian/patches/2003_externalize_session_config.patch b/debian/patches/2003_externalize_session_config.patch
index e402a58..b243e1d 100644
--- a/debian/patches/2003_externalize_session_config.patch
+++ b/debian/patches/2003_externalize_session_config.patch
@@ -2,67 +2,34 @@ Description: Externalize session config to yml in /etc
Forwarded: not-needed
Author: Jérémy Lal <kapouer at melix.org>
Last-Update: 2010-01-10
---- a/config/environment.rb
-+++ b/config/environment.rb
-@@ -19,6 +19,20 @@
- Encoding.default_external = 'UTF-8'
- end
-
-+# loads cookie based session session and secret keys
-+# this is needed here because initializers are loaded after plugins,
-+# and some plugins initialize ActionController which requires a secret to be set.
-+# crash if file not found
-+filename = ENV['RAILS_ETC'] ? File.join(ENV['RAILS_ETC'], 'session.yml') : File.join(File.dirname(__FILE__), '..', 'session.yml')
-+sessionconfig = YAML::load_file(filename)
-+require 'action_controller'
-+relativeUrlRoot = ENV['RAILS_RELATIVE_URL_ROOT']
-+ActionController::Base.session = {
-+ :key => sessionconfig[Rails.env]['key'],
-+ :secret => sessionconfig[Rails.env]['secret'],
-+ :path => (relativeUrlRoot.blank?) ? '/' : relativeUrlRoot
-+}
-+
- # Load Engine plugin if available
- begin
- require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
--- a/lib/tasks/initializers.rake
+++ b/lib/tasks/initializers.rake
@@ -1,11 +1,14 @@
- desc 'Generates a configuration file for cookie store sessions.'
+ desc 'Generates a secret token for the application.'
+task :generate_session_store do
--file 'config/initializers/session_store.rb' do
-- path = File.join(Rails.root, 'config', 'initializers', 'session_store.rb')
-- secret = ActiveSupport::SecureRandom.hex(40)
+-file 'config/initializers/secret_token.rb' do
+- path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
+- secret = SecureRandom.hex(40)
- File.open(path, 'w') do |f|
- f.write <<"EOF"
--# This file was generated by 'rake config/initializers/session_store.rb',
+-# This file was generated by 'rake generate_secret_token', and should
+ENV['X_DEBIAN_SITEID'] ||= 'default'
+ENV['RAILS_ETC'] ||= "/etc/redmine/#{ENV['X_DEBIAN_SITEID']}"
+filename = ENV['YML_SESSION_FILENAME'] ? ENV['YML_SESSION_FILENAME'] : 'session.yml'
+path = File.join(ENV['RAILS_ETC'] ? ENV['RAILS_ETC'] : File.join(Rails.root, 'config'), filename)
-+secret = ActiveSupport::SecureRandom.hex(40)
++secret = SecureRandom.hex(40)
+File.open(path, 'w') do |f|
+ f.write <<"EOF"
+# This file was generated by 'rake generate_session_store',
- # and should not be made visible to public.
+ # not be made visible to public.
# If you have a load-balancing Redmine cluster, you will need to use the
# same version of this file on each machine. And be sure to restart your
-@@ -15,20 +18,19 @@
+@@ -15,10 +18,18 @@ file 'config/initializers/secret_token.r
# change this key, all old sessions will become invalid! Make sure the
# secret is at least 30 characters and all random, no regular words or
# you'll be exposed to dictionary attacks.
--ActionController::Base.session = {
-- :key => '_redmine_session',
-- #
-- # Uncomment and edit the :session_path below if are hosting your Redmine
-- # at a suburi and don't want the top level path to access the cookies
-- #
-- # See: http://www.redmine.org/issues/3968
-- #
-- # :session_path => '/url_path_to/your/redmine/',
-- :secret => '#{secret}'
--}
+-RedmineApp::Application.config.secret_token = '#{secret}'
+
+production:
+ key: _redmine_#{ENV['X_DEBIAN_SITEID']}
@@ -75,10 +42,31 @@ Last-Update: 2010-01-10
+test:
+ key: _redmine_#{ENV['X_DEBIAN_SITEID']}
+ secret: #{secret}
-+
EOF
end
end
-
--desc 'Generates a configuration file for cookie store sessions.'
--task :generate_session_store => ['config/initializers/session_store.rb']
+-desc 'Generates a secret token for the application.'
+-task :generate_secret_token => ['config/initializers/secret_token.rb']
+--- a/config/environment.rb
++++ b/config/environment.rb
+@@ -28,5 +28,19 @@ if Dir.glob(File.join(vendor_plugins_dir
+ exit 1
+ end
+
++# loads cookie based session session and secret keys
++# this is needed here because initializers are loaded after plugins,
++# and some plugins initialize ActionController which requires a secret to be set.
++# crash if file not found
++filename = ENV['RAILS_ETC'] ? File.join(ENV['RAILS_ETC'], 'session.yml') : File.join(File.dirname(__FILE__), '..', 'session.yml')
++sessionconfig = YAML::load_file(filename)
++require 'action_controller'
++relativeUrlRoot = ENV['RAILS_RELATIVE_URL_ROOT']
++ActionController::Base.session = {
++ :key => sessionconfig[Rails.env]['key'],
++ :secret => sessionconfig[Rails.env]['secret'],
++ :path => (relativeUrlRoot.blank?) ? '/' : relativeUrlRoot
++}
++
+ # Initialize the rails application
+ RedmineApp::Application.initialize!
--
redmine.git
More information about the Pkg-ruby-extras-commits
mailing list