Commit 64124b50 by bergquist

add setting for how to long we should keep expired tokens

parent d3ec8e1c
......@@ -110,18 +110,21 @@ cache_mode = private
[login]
# login cookie name
# Login cookie name
cookie_name = grafana_session
# If you want login cookies to be https only. default is false
cookie_secure = false
# logged in user name
# Logged in user name
cookie_username = grafana_user
# how many days an session can be unused before we inactivate it
# How many days an session can be unused before we inactivate it
login_remember_days = 7
# How long should Grafana keep expired tokens before deleting them
delete_expired_token_after_days = 30
#################################### Session #############################
[session]
# Either "memory", "file", "redis", "mysql", "postgres", "memcache", default is "file"
......
......@@ -7,7 +7,7 @@ import (
func (srv *UserAuthTokenServiceImpl) Run(ctx context.Context) error {
ticker := time.NewTicker(time.Hour * 12)
deleteSessionAfter := time.Hour * 24 * 7 * 30
deleteSessionAfter := time.Hour * 24 * time.Duration(srv.Cfg.LoginDeleteExpiredTokensAfterDays)
for {
select {
......
......@@ -224,10 +224,11 @@ type Cfg struct {
EnableAlphaPanels bool
EnterpriseLicensePath string
LoginCookieName string
LoginCookieUsername string
LoginCookieSecure bool
LoginCookieMaxDays int
LoginCookieName string
LoginCookieUsername string
LoginCookieSecure bool
LoginCookieMaxDays int
LoginDeleteExpiredTokensAfterDays int
}
type CommandLineArgs struct {
......@@ -553,10 +554,11 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
//login
login := iniFile.Section("login")
cfg.LoginCookieName = login.Key("cookie_name").String()
cfg.LoginCookieMaxDays = login.Key("login_remember_days").MustInt()
cfg.LoginCookieName = login.Key("cookie_name").MustString("grafana_session")
cfg.LoginCookieMaxDays = login.Key("login_remember_days").MustInt(7)
cfg.LoginCookieSecure = login.Key("cookie_secure").MustBool(false)
cfg.LoginCookieUsername = login.Key("cookie_username").String()
cfg.LoginCookieUsername = login.Key("cookie_username").MustString("grafana_username")
cfg.LoginDeleteExpiredTokensAfterDays = login.Key("delete_expired_token_after_days").MustInt(30)
Env = iniFile.Section("").Key("app_mode").MustString("development")
InstanceName = iniFile.Section("").Key("instance_name").MustString("unknown_instance_name")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment