mirror of
https://github.com/distribution/distribution
synced 2024-11-06 19:35:52 +01:00
Improve error message in case invalid env var found
If you set an env var with non-yaml content but accidentally collides with a possible configuration env var,... The current error is ```configuration error: error parsing /etc/docker/registry/config.yml: yaml: unmarshal errors: line 1: cannot unmarshal !!str `tcp://1...` into configuration.Parameters``` With this change we can see at least which is the problematic env var. Some orchestrators such as docker-compose set env vars on top on user env vars, so debugging can be tricky if you are not passing vars, and the error is pointing you to a problably valid config file. Signed-off-by: Rober Morales-Chaparro <rober@rstor.io> Signed-off-by: Rober Morales-Chaparro <rober.morales@ebury.com>
This commit is contained in:
parent
41a0452eea
commit
579107cf2e
@ -206,6 +206,7 @@ func (p *Parser) overwriteStruct(v reflect.Value, fullpath string, path []string
|
||||
fieldVal := reflect.New(sf.Type)
|
||||
err := yaml.Unmarshal([]byte(payload), fieldVal.Interface())
|
||||
if err != nil {
|
||||
logrus.Warnf("Error parsing environment variable %s", fullpath)
|
||||
return err
|
||||
}
|
||||
field.Set(reflect.Indirect(fieldVal))
|
||||
|
Loading…
Reference in New Issue
Block a user