Snapshots: Add snapshot enable config (#61587)
* Add config to remove Snapshot functionality (frontend is hidden and validation in the backend) * Add test cases * Remove unused mock on the test * Moving Snapshot config from globar variables to settings.Cfg * Removing warnings on code
This commit is contained in:
+12
-10
@@ -87,12 +87,6 @@ var (
|
||||
CookieSameSiteDisabled bool
|
||||
CookieSameSiteMode http.SameSite
|
||||
|
||||
// Snapshots
|
||||
ExternalSnapshotUrl string
|
||||
ExternalSnapshotName string
|
||||
ExternalEnabled bool
|
||||
SnapShotRemoveExpired bool
|
||||
|
||||
// Dashboard history
|
||||
DashboardVersionsToKeep int
|
||||
MinRefreshInterval string
|
||||
@@ -407,6 +401,12 @@ type Cfg struct {
|
||||
DataSourceLimit int
|
||||
|
||||
// Snapshots
|
||||
SnapshotEnabled bool
|
||||
ExternalSnapshotUrl string
|
||||
ExternalSnapshotName string
|
||||
ExternalEnabled bool
|
||||
SnapShotRemoveExpired bool
|
||||
|
||||
SnapshotPublicMode bool
|
||||
|
||||
ErrTemplateName string
|
||||
@@ -1702,11 +1702,13 @@ func IsLegacyAlertingEnabled() bool {
|
||||
func readSnapshotsSettings(cfg *Cfg, iniFile *ini.File) error {
|
||||
snapshots := iniFile.Section("snapshots")
|
||||
|
||||
ExternalSnapshotUrl = valueAsString(snapshots, "external_snapshot_url", "")
|
||||
ExternalSnapshotName = valueAsString(snapshots, "external_snapshot_name", "")
|
||||
cfg.SnapshotEnabled = snapshots.Key("enabled").MustBool(true)
|
||||
|
||||
ExternalEnabled = snapshots.Key("external_enabled").MustBool(true)
|
||||
SnapShotRemoveExpired = snapshots.Key("snapshot_remove_expired").MustBool(true)
|
||||
cfg.ExternalSnapshotUrl = valueAsString(snapshots, "external_snapshot_url", "")
|
||||
cfg.ExternalSnapshotName = valueAsString(snapshots, "external_snapshot_name", "")
|
||||
|
||||
cfg.ExternalEnabled = snapshots.Key("external_enabled").MustBool(true)
|
||||
cfg.SnapShotRemoveExpired = snapshots.Key("snapshot_remove_expired").MustBool(true)
|
||||
cfg.SnapshotPublicMode = snapshots.Key("public_mode").MustBool(false)
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user