2011-10-08 17:36:38 -04:00
|
|
|
# Be sure to restart your server when you modify this file.
|
|
|
|
|
2015-06-13 00:22:55 -04:00
|
|
|
require 'gitlab/current_settings'
|
|
|
|
include Gitlab::CurrentSettings
|
2015-09-09 10:19:58 -04:00
|
|
|
|
2015-11-24 09:57:28 -05:00
|
|
|
# allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done
|
2015-09-09 10:19:58 -04:00
|
|
|
begin
|
2015-11-24 09:57:28 -05:00
|
|
|
Settings.gitlab['session_expire_delay'] = current_application_settings.session_expire_delay || 10080
|
2015-09-09 10:19:58 -04:00
|
|
|
rescue
|
2015-11-24 06:11:31 -05:00
|
|
|
Settings.gitlab['session_expire_delay'] ||= 10080
|
2015-09-09 10:19:58 -04:00
|
|
|
end
|
2015-06-05 13:16:32 -04:00
|
|
|
|
2015-10-22 09:38:11 -04:00
|
|
|
if Rails.env.test?
|
|
|
|
Gitlab::Application.config.session_store :cookie_store, key: "_gitlab_session"
|
|
|
|
else
|
2016-03-16 13:10:03 -04:00
|
|
|
redis_config = Gitlab::Redis.redis_store_options
|
2016-04-13 06:20:57 -04:00
|
|
|
redis_config[:namespace] = Gitlab::Redis::SESSION_NAMESPACE
|
2016-03-09 09:16:46 -05:00
|
|
|
|
2015-10-22 09:38:11 -04:00
|
|
|
Gitlab::Application.config.session_store(
|
|
|
|
:redis_store, # Using the cookie_store would enable session replay attacks.
|
2016-03-09 09:16:46 -05:00
|
|
|
servers: redis_config,
|
2015-10-22 09:38:11 -04:00
|
|
|
key: '_gitlab_session',
|
|
|
|
secure: Gitlab.config.gitlab.https,
|
|
|
|
httponly: true,
|
2016-05-02 11:22:03 -04:00
|
|
|
expires_in: Settings.gitlab['session_expire_delay'] * 60,
|
2016-05-30 09:07:18 -04:00
|
|
|
path: Rails.application.config.relative_url_root.nil? ? '/' : Gitlab::Application.config.relative_url_root
|
2015-10-22 09:38:11 -04:00
|
|
|
)
|
|
|
|
end
|