Fix YAML patch in some cases #1626

This commit is contained in:
Alex X
2025-03-07 21:44:23 +03:00
parent 39c14e6556
commit a15deedf0d
6 changed files with 237 additions and 248 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ func LoadConfig(v any) {
}
}
func PatchConfig(key string, value any, path ...string) error {
func PatchConfig(path []string, value any) error {
if ConfigPath == "" {
return errors.New("config file disabled")
}
@@ -26,7 +26,7 @@ func PatchConfig(key string, value any, path ...string) error {
// empty config is OK
b, _ := os.ReadFile(ConfigPath)
b, err := yaml.Patch(b, key, value, path...)
b, err := yaml.Patch(b, path, value)
if err != nil {
return err
}