The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/setting/setting_featuremgmt.go

38 lines
1.4 KiB

package setting
import (
"github.com/grafana/grafana/pkg/util"
)
type FeatureMgmtSettings struct {
HiddenToggles map[string]struct{}
ReadOnlyToggles map[string]struct{}
AllowEditing bool
UpdateWebhook string
UpdateWebhookToken string
}
func (cfg *Cfg) readFeatureManagementConfig() {
section := cfg.Raw.Section("feature_management")
hiddenToggles := make(map[string]struct{})
readOnlyToggles := make(map[string]struct{})
// parse the comma separated list in `hidden_toggles`.
hiddenTogglesStr := valueAsString(section, "hidden_toggles", "")
for _, feature := range util.SplitString(hiddenTogglesStr) {
hiddenToggles[feature] = struct{}{}
}
// parse the comma separated list in `read_only_toggles`.
readOnlyTogglesStr := valueAsString(section, "read_only_toggles", "")
for _, feature := range util.SplitString(readOnlyTogglesStr) {
readOnlyToggles[feature] = struct{}{}
}
cfg.FeatureManagement.HiddenToggles = hiddenToggles
cfg.FeatureManagement.ReadOnlyToggles = readOnlyToggles
cfg.FeatureManagement.AllowEditing = cfg.SectionWithEnvOverrides("feature_management").Key("allow_editing").MustBool(false)
cfg.FeatureManagement.UpdateWebhook = cfg.SectionWithEnvOverrides("feature_management").Key("update_webhook").MustString("")
cfg.FeatureManagement.UpdateWebhookToken = cfg.SectionWithEnvOverrides("feature_management").Key("update_webhook_token").MustString("")
}