Skip to content

Commit 7c6a784

Browse files
committed
fixed dirloading
1 parent 8ca08d0 commit 7c6a784

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

utils/config/config.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package config
33
import (
44
"os"
55
"path/filepath"
6-
"strconv"
76
"strings"
87
"sync"
98

@@ -56,7 +55,9 @@ func LoadDir(path string, dir string, config *koanf.Koanf, parser koanf.Parser)
5655
return err
5756
}
5857

59-
for i, file := range files {
58+
data := []map[string]any{}
59+
60+
for _, file := range files {
6061
tmp := koanf.New(".")
6162

6263
_, err := LoadFile(file, tmp, parser)
@@ -65,9 +66,11 @@ func LoadDir(path string, dir string, config *koanf.Koanf, parser koanf.Parser)
6566
return err
6667
}
6768

68-
config.Set(path + "." + strconv.Itoa(i), tmp.All())
69+
data = append(data, tmp.All())
6970
}
7071

72+
config.Set(path, data)
73+
7174
return nil
7275
}
7376

0 commit comments

Comments
 (0)