Skip to content
Snippets Groups Projects
Commit f4e46d41 authored by Jan Semmelink's avatar Jan Semmelink
Browse files

Update config

parent 6a0f9ef4
No related branches found
No related tags found
1 merge request!5Add search client for OpenSearch to log and query API events
......@@ -24,7 +24,15 @@ func Load(prefix string, configPtr interface{}) error {
return errors.Errorf("%T is not &struct", configPtr)
}
v := reflect.ValueOf(configPtr)
return load(prefix, t.Elem(), v.Elem())
if err := load(prefix, t.Elem(), v.Elem()); err != nil {
return errors.Wrapf(err, "failed to load config with prefix %s", prefix)
}
if validator, ok := configPtr.(Validator); ok {
if err := validator.Validate(); err != nil {
return errors.Wrapf(err, "invalid config with prefix %s", prefix)
}
}
return nil
}
type nameValue struct {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment