diff --git a/config/persistence.go b/config/persistence.go index dd2a182..4ffbde3 100644 --- a/config/persistence.go +++ b/config/persistence.go @@ -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() } diff --git a/config/validate.go b/config/validate.go index 7936bd7..6807eb2 100644 --- a/config/validate.go +++ b/config/validate.go @@ -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: