* Expressions: Add option to disable feature
* Apply suggestions from code review
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
(cherry picked from commit 9ada4b6052)
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
This commit is contained in:
co-authored by
Sofia Papagiannaki
parent
7592031b36
commit
fcfb12d0b3
@@ -339,6 +339,9 @@ type Cfg struct {
|
||||
AutoAssignOrg bool
|
||||
AutoAssignOrgId int
|
||||
AutoAssignOrgRole string
|
||||
|
||||
// ExpressionsEnabled specifies whether expressions are enabled.
|
||||
ExpressionsEnabled bool
|
||||
}
|
||||
|
||||
// IsLiveEnabled returns if grafana live should be enabled
|
||||
@@ -482,6 +485,11 @@ func (cfg *Cfg) readAnnotationSettings() {
|
||||
cfg.APIAnnotationCleanupSettings = newAnnotationCleanupSettings(apiIAnnotation, "max_age")
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readExpressionsSettings() {
|
||||
expressions := cfg.Raw.Section("expressions")
|
||||
cfg.ExpressionsEnabled = expressions.Key("enabled").MustBool(true)
|
||||
}
|
||||
|
||||
type AnnotationCleanupSettings struct {
|
||||
MaxAge time.Duration
|
||||
MaxCount int64
|
||||
@@ -850,6 +858,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
||||
cfg.readSmtpSettings()
|
||||
cfg.readQuotaSettings()
|
||||
cfg.readAnnotationSettings()
|
||||
cfg.readExpressionsSettings()
|
||||
if err := cfg.readGrafanaEnvironmentMetrics(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user