fix PluginSettings.
This commit is contained in:
parent
15591287cf
commit
8ce16e2280
1 changed files with 3 additions and 1 deletions
|
|
@ -75,6 +75,7 @@ func (p PluginSettings) Unmarshal(name string, def any) error {
|
||||||
if p == nil {
|
if p == nil {
|
||||||
return fmt.Errorf("%w: %s", ErrPluginSettingsNotFound, name)
|
return fmt.Errorf("%w: %s", ErrPluginSettingsNotFound, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop through the plugin settings and take only the one that starts with the name
|
// loop through the plugin settings and take only the one that starts with the name
|
||||||
// because the settings are stored in a map["plugin_name.setting_name"] = value
|
// because the settings are stored in a map["plugin_name.setting_name"] = value
|
||||||
newMap := make(map[string]any)
|
newMap := make(map[string]any)
|
||||||
|
|
@ -83,9 +84,10 @@ func (p PluginSettings) Unmarshal(name string, def any) error {
|
||||||
newMap[strings.TrimPrefix(k, name+".")] = v
|
newMap[strings.TrimPrefix(k, name+".")] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("newMap: %+v\n", newMap)
|
|
||||||
if len(newMap) == 0 {
|
if len(newMap) == 0 {
|
||||||
return fmt.Errorf("%w: %s", ErrPluginSettingsNotFound, name)
|
return fmt.Errorf("%w: %s", ErrPluginSettingsNotFound, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return utils.Decode(newMap, def)
|
return utils.Decode(newMap, def)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue