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

Update config

parent 6a0f9ef4
Branches
Tags
1 merge request!5Add search client for OpenSearch to log and query API events
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
...@@ -24,7 +24,15 @@ func Load(prefix string, configPtr interface{}) error { ...@@ -24,7 +24,15 @@ func Load(prefix string, configPtr interface{}) error {
return errors.Errorf("%T is not &struct", configPtr) return errors.Errorf("%T is not &struct", configPtr)
} }
v := reflect.ValueOf(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 { type nameValue struct {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment