Add verbose settings (#65469)
* Add `settings.CurrentVerbose` function * Add function to retrieve verbose settings * Add `/settings-verbose` endpoint * Restrict the verbose source types
This commit is contained in:
+18
-3
@@ -36,6 +36,9 @@ type Provider interface {
|
||||
// the current configured pairs of key/values for each
|
||||
// configuration section.
|
||||
Current() SettingsBag
|
||||
|
||||
CurrentVerbose() VerboseSettingsBag
|
||||
|
||||
// Update receives a SettingsBag with the pairs of key/values
|
||||
// to be updated per section and a SettingsRemovals with the
|
||||
// section keys to be removed.
|
||||
@@ -92,6 +95,14 @@ type ReloadHandler interface {
|
||||
type SettingsBag map[string]map[string]string
|
||||
type SettingsRemovals map[string][]string
|
||||
|
||||
type VerboseSourceType string
|
||||
type VerboseSettingsBag map[string]map[string]map[VerboseSourceType]string
|
||||
|
||||
const (
|
||||
DB VerboseSourceType = "db"
|
||||
System VerboseSourceType = "system"
|
||||
)
|
||||
|
||||
func ProvideProvider(cfg *Cfg) *OSSImpl {
|
||||
return &OSSImpl{
|
||||
Cfg: cfg,
|
||||
@@ -102,7 +113,7 @@ type OSSImpl struct {
|
||||
Cfg *Cfg
|
||||
}
|
||||
|
||||
func (o OSSImpl) Current() SettingsBag {
|
||||
func (o *OSSImpl) Current() SettingsBag {
|
||||
settingsCopy := make(SettingsBag)
|
||||
|
||||
for _, section := range o.Cfg.Raw.Sections() {
|
||||
@@ -115,6 +126,10 @@ func (o OSSImpl) Current() SettingsBag {
|
||||
return settingsCopy
|
||||
}
|
||||
|
||||
func (o *OSSImpl) CurrentVerbose() VerboseSettingsBag {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (OSSImpl) Update(SettingsBag, SettingsRemovals) error {
|
||||
return errors.New("oss settings provider do not have support for settings updates")
|
||||
}
|
||||
@@ -127,9 +142,9 @@ func (o *OSSImpl) Section(section string) Section {
|
||||
return §ionImpl{section: o.Cfg.Raw.Section(section)}
|
||||
}
|
||||
|
||||
func (OSSImpl) RegisterReloadHandler(string, ReloadHandler) {}
|
||||
func (*OSSImpl) RegisterReloadHandler(string, ReloadHandler) {}
|
||||
|
||||
func (o OSSImpl) IsFeatureToggleEnabled(name string) bool {
|
||||
func (o *OSSImpl) IsFeatureToggleEnabled(name string) bool {
|
||||
return o.Cfg.IsFeatureToggleEnabled(name)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user