FeatureFlags: Cleanup usage of cfg.IsFeatureToggleEnabled (#78014)

This commit is contained in:
Ryan McKinley
2023-11-13 07:55:15 -08:00
committed by GitHub
parent 2b146b97b4
commit 3509a5abb9
37 changed files with 147 additions and 211 deletions
+13
View File
@@ -980,9 +980,22 @@ func NewCfg() *Cfg {
Logger: log.New("settings"),
Raw: ini.Empty(),
Azure: &azsettings.AzureSettings{},
// Avoid nil pointer
IsFeatureToggleEnabled: func(_ string) bool {
return false
},
}
}
// Deprecated: Avoid using IsFeatureToggleEnabled from settings. If you need to access
// feature flags, read them from the FeatureToggle (or FeatureManager) interface
func NewCfgWithFeatures(features func(string) bool) *Cfg {
cfg := NewCfg()
cfg.IsFeatureToggleEnabled = features
return cfg
}
func NewCfgFromArgs(args CommandLineArgs) (*Cfg, error) {
cfg := NewCfg()
if err := cfg.Load(args); err != nil {