Settings: Add a method to Provider interface to check if a feature is enabled (#41250)

* Settings: Add method to Provider interface to get feature toggles

* Apply review comment
This commit is contained in:
Tania B 2021-11-03 16:37:16 +02:00 committed by GitHub
parent 1c3c1a52bb
commit da39c6ce55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,8 @@ type Provider interface {
// RegisterReloadHandler registers a handler for validation and reload
// of configuration updates tied to a specific section
RegisterReloadHandler(section string, handler ReloadHandler)
// IsFeatureToggleEnabled checks if the feature's toggle is enabled
IsFeatureToggleEnabled(name string) bool
}
// Section is a settings section copy
@ -129,6 +131,10 @@ func (o *OSSImpl) Section(section string) Section {
func (OSSImpl) RegisterReloadHandler(string, ReloadHandler) {}
func (o OSSImpl) IsFeatureToggleEnabled(name string) bool {
return o.Cfg.FeatureToggles[name]
}
type keyValImpl struct {
key *ini.Key
}