mirror of
https://github.com/safing/portbase
synced 2025-09-01 10:09:50 +00:00
Add config.GetActiveConfigValues to export active config values
This commit is contained in:
parent
1ffef463f8
commit
38d3c839ef
1 changed files with 19 additions and 0 deletions
|
@ -112,3 +112,22 @@ func AddToDebugInfo(di *debug.Info) {
|
|||
lines...,
|
||||
)
|
||||
}
|
||||
|
||||
// GetActiveConfigValues returns a map with the active config values.
|
||||
func GetActiveConfigValues() map[string]interface{} {
|
||||
values := make(map[string]interface{})
|
||||
|
||||
// Collect active values from options.
|
||||
_ = ForEachOption(func(opt *Option) error {
|
||||
opt.Lock()
|
||||
defer opt.Unlock()
|
||||
|
||||
if opt.ReleaseLevel <= getReleaseLevel() && opt.activeValue != nil {
|
||||
values[opt.Key] = opt.activeValue.getData(opt)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return values
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue