mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* create roles for writing feature toggles * create update endpoint / handler * api changes * add feature toggle validations * hide toggles based on their state * make FlagFeatureToggle read only * add username log * add username string * refactor for better readability * refactor unit tests so we can do more validations * some skeletoning for the set tests * write unit tests for updater * break helper functions out * update sample ini to match defaults * add more logic to ReadOnly label * add user documentation * fix lint issue * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: J Stickler <julie.stickler@grafana.com> * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: J Stickler <julie.stickler@grafana.com> * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: J Stickler <julie.stickler@grafana.com> * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: J Stickler <julie.stickler@grafana.com> * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: J Stickler <julie.stickler@grafana.com> * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: J Stickler <julie.stickler@grafana.com> --------- Co-authored-by: IbrahimCSAE <ibrahim.mdev@gmail.com> Co-authored-by: J Stickler <julie.stickler@grafana.com>
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package setting
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/util"
|
|
)
|
|
|
|
type FeatureMgmtSettings struct {
|
|
HiddenToggles map[string]struct{}
|
|
ReadOnlyToggles map[string]struct{}
|
|
AllowEditing bool
|
|
UpdateControllerUrl 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.UpdateControllerUrl = cfg.SectionWithEnvOverrides("feature_management").Key("update_controller_url").MustString("")
|
|
}
|