Short Links: Add setting for changing expiration time (#86003)

* Add setting for changing shortlink expiration time

* Add docs, add better language

* put all the numbers in the duration 🤷

* 🙄

* update language to be correct and clear

* Add max limit and more documentation
This commit is contained in:
Kristina
2024-04-22 07:39:24 -05:00
committed by GitHub
parent cad9e23e54
commit 2247d6c415
5 changed files with 28 additions and 2 deletions

View File

@@ -516,6 +516,9 @@ type Cfg struct {
// Experimental scope settings
ScopesListScopesURL string
ScopesListDashboardsURL string
//Short Links
ShortLinkExpiration int
}
// AddChangePasswordLink returns if login form is disabled or not since
@@ -1158,6 +1161,14 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error {
queryHistory := iniFile.Section("query_history")
cfg.QueryHistoryEnabled = queryHistory.Key("enabled").MustBool(true)
shortLinks := iniFile.Section("short_links")
cfg.ShortLinkExpiration = shortLinks.Key("expire_time").MustInt(7)
if cfg.ShortLinkExpiration > 365 {
cfg.Logger.Warn("short_links expire_time must be less than 366 days. Setting to 365 days")
cfg.ShortLinkExpiration = 365
}
panelsSection := iniFile.Section("panels")
cfg.DisableSanitizeHtml = panelsSection.Key("disable_sanitize_html").MustBool(false)