mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Settings: Remove global variable (#26613)
This commit is contained in:
parent
ae3c285312
commit
3defb4441e
@ -7,7 +7,6 @@ import (
|
|||||||
|
|
||||||
"github.com/grafana/grafana/pkg/models"
|
"github.com/grafana/grafana/pkg/models"
|
||||||
"github.com/grafana/grafana/pkg/plugins"
|
"github.com/grafana/grafana/pkg/plugins"
|
||||||
"github.com/grafana/grafana/pkg/setting"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/api/dtos"
|
"github.com/grafana/grafana/pkg/api/dtos"
|
||||||
"github.com/grafana/grafana/pkg/bus"
|
"github.com/grafana/grafana/pkg/bus"
|
||||||
@ -77,7 +76,7 @@ func (hs *HTTPServer) QueryMetricsV2(c *models.ReqContext, reqDto dtos.MetricReq
|
|||||||
return Error(500, "Metric request error", err)
|
return Error(500, "Metric request error", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !setting.IsExpressionsEnabled() {
|
if !hs.Cfg.IsExpressionsEnabled() {
|
||||||
return Error(404, "Expressions feature toggle is not enabled", nil)
|
return Error(404, "Expressions feature toggle is not enabled", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,6 @@ var (
|
|||||||
S3TempImageStoreSecretKey string
|
S3TempImageStoreSecretKey string
|
||||||
|
|
||||||
ImageUploadProvider string
|
ImageUploadProvider string
|
||||||
FeatureToggles map[string]bool
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO move all global vars to this struct
|
// TODO move all global vars to this struct
|
||||||
@ -1023,7 +1022,6 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
|||||||
for _, feature := range util.SplitString(featuresTogglesStr) {
|
for _, feature := range util.SplitString(featuresTogglesStr) {
|
||||||
cfg.FeatureToggles[feature] = true
|
cfg.FeatureToggles[feature] = true
|
||||||
}
|
}
|
||||||
FeatureToggles = cfg.FeatureToggles
|
|
||||||
|
|
||||||
// check old location for this option
|
// check old location for this option
|
||||||
if panelsSection.Key("enable_alpha").MustBool(false) {
|
if panelsSection.Key("enable_alpha").MustBool(false) {
|
||||||
@ -1191,11 +1189,3 @@ func (s *DynamicSection) Key(k string) *ini.Key {
|
|||||||
func (cfg *Cfg) SectionWithEnvOverrides(s string) *DynamicSection {
|
func (cfg *Cfg) SectionWithEnvOverrides(s string) *DynamicSection {
|
||||||
return &DynamicSection{cfg.Raw.Section(s), cfg.Logger}
|
return &DynamicSection{cfg.Raw.Section(s), cfg.Logger}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsExpressionsEnabled() bool {
|
|
||||||
v, ok := FeatureToggles["expressions"]
|
|
||||||
if !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user