From 77ce35e557cfd7bca772a9b195580c048b276ac2 Mon Sep 17 00:00:00 2001 From: nmarrs Date: Tue, 9 Dec 2025 07:40:34 -0800 Subject: [PATCH] Short Links: Change default expiration to never expire (-1) Previously, short links defaulted to expiring after 7 days. This change updates the default to -1 (never expire) to prevent automatic deletion of shared dashboard links. Changes: - conf/defaults.ini: Set expire_time = -1 and update comment - conf/sample.ini: Set expire_time = -1 and update comment - pkg/setting/setting.go: Update MustInt default from 7 to -1 The cleanup logic already handles -1 correctly (only runs when > 0), so no changes needed there. This unblocks progress on short URL feature improvements by ensuring shared links remain accessible indefinitely by default. --- conf/defaults.ini | 4 ++-- conf/sample.ini | 4 ++-- pkg/setting/setting.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index a72b0183290..bb462b5c745 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -1747,9 +1747,9 @@ enabled = true #################################### Short Links ############################# [short_links] -# Short links that are never accessed will be deleted as cleanup. Time is set up in days. The default is 7 days. Maximum value is 365. +# Short links that are never accessed will be deleted as cleanup. Time is set up in days. The default is -1 (never expire). Maximum value is 365. # 0 means they will be deleted approximately every 10 minutes. A negative value (such as -1) will disable expiration. -expire_time = 7 +expire_time = -1 #################################### Internal Grafana Metrics ############ # Metrics available at HTTP URL /metrics and /metrics/plugins/:pluginId diff --git a/conf/sample.ini b/conf/sample.ini index d6397f894e4..ed39a012a2d 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -1689,8 +1689,8 @@ default_datasource_uid = #################################### Short Links ############################# [short_links] -# Short links which are never accessed will be deleted as cleanup. Time is in days. Default is 7 days. Max is 365. 0 means they will be deleted approximately every 10 minutes. -;expire_time = 7 +# Short links which are never accessed will be deleted as cleanup. Time is in days. Default is -1 (never expire). Max is 365. 0 means they will be deleted approximately every 10 minutes. A negative value (such as -1) will disable expiration. +;expire_time = -1 #################################### Internal Grafana Metrics ########################## # Metrics available at HTTP URL /metrics and /metrics/plugins/:pluginId diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index f6c0b3d3f19..cc59427da6f 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -1330,7 +1330,7 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error { cfg.QueryHistoryEnabled = queryHistory.Key("enabled").MustBool(true) shortLinks := iniFile.Section("short_links") - cfg.ShortLinkExpiration = shortLinks.Key("expire_time").MustInt(7) + cfg.ShortLinkExpiration = shortLinks.Key("expire_time").MustInt(-1) if cfg.ShortLinkExpiration > 365 { cfg.Logger.Warn("short_links expire_time must be less than 366 days. Setting to 365 days")