From d5b2f94c7cde784db5177edc55960c2a948df61b Mon Sep 17 00:00:00 2001 From: James Hewitt Date: Tue, 5 Jul 2022 17:57:12 +0100 Subject: [PATCH] Say when a config error is caused by an env var Without this, the log message for the user indicates a problem with the yaml file, so identifying the actual error is hard. This change fixes the output so that the incorrect environment variable is easy to spot. Fixes #3653 Signed-off-by: James Hewitt --- configuration/parser.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configuration/parser.go b/configuration/parser.go index 25023092c..2b389f1f3 100644 --- a/configuration/parser.go +++ b/configuration/parser.go @@ -138,7 +138,7 @@ func (p *Parser) Parse(in []byte, v interface{}) error { err = p.overwriteFields(parseAs, pathStr, path[1:], envVar.value) if err != nil { - return err + return fmt.Errorf("parsing environment variable %s: %v", pathStr, err) } } } @@ -206,7 +206,6 @@ 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: %s", fullpath, err) return err } field.Set(reflect.Indirect(fieldVal))