mirror of
https://github.com/safing/portbase
synced 2025-09-01 18:19:57 +00:00
Fix config persistence
This commit is contained in:
parent
f074aa5770
commit
a842929e55
2 changed files with 16 additions and 1 deletions
|
@ -47,7 +47,7 @@ func saveConfig() error {
|
|||
for key, option := range options {
|
||||
option.Lock()
|
||||
if option.activeValue != nil {
|
||||
activeValues[key] = option.activeValue
|
||||
activeValues[key] = option.activeValue.getData(option)
|
||||
}
|
||||
option.Unlock()
|
||||
}
|
||||
|
|
|
@ -13,6 +13,21 @@ type valueCache struct {
|
|||
boolVal bool
|
||||
}
|
||||
|
||||
func (vc *valueCache) getData(opt *Option) interface{} {
|
||||
switch opt.OptType {
|
||||
case OptTypeBool:
|
||||
return vc.boolVal
|
||||
case OptTypeInt:
|
||||
return vc.intVal
|
||||
case OptTypeString:
|
||||
return vc.stringVal
|
||||
case OptTypeStringArray:
|
||||
return vc.stringArrayVal
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func validateValue(option *Option, value interface{}) (*valueCache, error) { //nolint:gocyclo
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
|
|
Loading…
Add table
Reference in a new issue