#8 up parse yaml

This commit is contained in:
Gorbunov Kirill Andreevich
2024-03-31 15:16:22 +03:00
parent 55c0bdb49a
commit edfe5731f2
3 changed files with 9 additions and 19 deletions

View File

@@ -104,13 +104,18 @@ func main() {
for _, configDir := range configDirs {
for _, configFile := range configFiles {
path := filepath.Join(configDir, configFile)
if _, err = os.Stat(path); os.IsNotExist(err) {
continue
}
c := fileconfig.NewConfig(
config.AllowFail(false),
config.Struct(cfg),
options.Codec(yamlcodec.NewCodec()),
fileconfig.Path(filepath.Join(configDir, configFile)),
fileconfig.Path(path),
)
err = c.Init(options.Context(ctx))
err = c.Init()
if err != nil {
logger.Error(ctx, fmt.Sprintf("failed to init config: %v", err))
}