feat: use tag & json loader only
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
92f375ed01
commit
f4bc61654c
|
@ -61,11 +61,21 @@ type OptionalCmd struct {
|
|||
}
|
||||
|
||||
func parseConfFile(path string) (conf Conf, err error) {
|
||||
m := multiconfig.NewWithPath(path)
|
||||
if err = m.Load(&conf); err != nil {
|
||||
d := &multiconfig.DefaultLoader{}
|
||||
d.Loader = multiconfig.MultiLoader(
|
||||
&multiconfig.TagLoader{},
|
||||
&multiconfig.JSONLoader{Path: path},
|
||||
)
|
||||
d.Validator = multiconfig.MultiValidator(&multiconfig.RequiredValidator{})
|
||||
if err = d.Load(&conf); err != nil {
|
||||
slog.Error("parse stages conf", "error", err)
|
||||
return
|
||||
}
|
||||
if err = d.Validate(&conf); err != nil {
|
||||
slog.Error("validate stages conf", "error", err)
|
||||
return
|
||||
}
|
||||
slog.Error("parse stages conf", "conf", conf)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user