conf: overhaul sessions settings (#5952)

This commit is contained in:
ᴜɴᴋɴᴡᴏɴ
2020-02-29 00:26:03 +08:00
committed by GitHub
parent 1898201b8b
commit d59b0f6ff7
12 changed files with 127 additions and 108 deletions

View File

@@ -211,6 +211,22 @@ var (
User struct {
EnableEmailNotification bool
}
// Session settings
Session struct {
Provider string
ProviderConfig string
CookieName string
CookieSecure bool
GCInterval int64 `ini:"GC_INTERVAL"`
MaxLifeTime int64
CSRFCookieName string `ini:"CSRF_COOKIE_NAME"`
// Deprecated: Use GCInterval instead, will be removed in 0.13.
GCIntervalTime int64 `ini:"GC_INTERVAL_TIME"`
// Deprecated: Use MaxLifeTime instead, will be removed in 0.13.
SessionLifeTime int64
}
)
// handleDeprecated transfers deprecated values to the new ones when set.
@@ -268,4 +284,13 @@ func handleDeprecated() {
User.EnableEmailNotification = true
Auth.EnableNotifyMail = false
}
if Session.GCIntervalTime > 0 {
Session.GCInterval = Session.GCIntervalTime
Session.GCIntervalTime = 0
}
if Session.SessionLifeTime > 0 {
Session.MaxLifeTime = Session.SessionLifeTime
Session.SessionLifeTime = 0
}
}