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'
|
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
|
2017-08-31 05:47:03 -04:00
|
|
|
Settings.gitlab['session_expire_delay'] = Gitlab::CurrentSettings.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
|
|
|
|
2017-06-01 02:15:58 -04:00
|
|
|
cookie_key = if Rails.env.development?
|
|
|
|
"_gitlab_session_#{Digest::SHA256.hexdigest(Rails.root.to_s)}"
|
|
|
|
else
|
|
|
|
"_gitlab_session"
|
|
|
|
end
|
|
|
|
|
2018-05-02 04:08:16 -04:00
|
|
|
sessions_config = Gitlab::Redis::SharedState.params
|
|
|
|
sessions_config[:namespace] = Gitlab::Redis::SharedState::SESSION_NAMESPACE
|
2016-05-30 17:13:42 -04:00
|
|
|
|
2018-05-02 04:08:16 -04:00
|
|
|
Gitlab::Application.config.session_store(
|
|
|
|
:redis_store, # Using the cookie_store would enable session replay attacks.
|
|
|
|
servers: sessions_config,
|
|
|
|
key: cookie_key,
|
|
|
|
secure: Gitlab.config.gitlab.https,
|
|
|
|
httponly: true,
|
|
|
|
expires_in: Settings.gitlab['session_expire_delay'] * 60,
|
|
|
|
path: Rails.application.config.relative_url_root.nil? ? '/' : Gitlab::Application.config.relative_url_root
|
|
|
|
)
|