From 1c201295d0ceaffcd293d81b2ced34c3b2e7c051 Mon Sep 17 00:00:00 2001 From: Alan Moran Date: Tue, 11 Jun 2024 13:07:43 +0200 Subject: [PATCH] Fix config issue with error handling --- src/autoscaler/metricsforwarder/config/config.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/autoscaler/metricsforwarder/config/config.go b/src/autoscaler/metricsforwarder/config/config.go index 217d43d42e..e8a964f4f0 100644 --- a/src/autoscaler/metricsforwarder/config/config.go +++ b/src/autoscaler/metricsforwarder/config/config.go @@ -90,6 +90,9 @@ func LoadConfig(reader io.Reader) (*Config, error) { dec := yaml.NewDecoder(reader) dec.KnownFields(true) err := dec.Decode(conf) + if err != nil { + return nil, err + } if os.Getenv("PORT") != "" { port := os.Getenv("PORT") @@ -100,10 +103,6 @@ func LoadConfig(reader io.Reader) (*Config, error) { conf.Server.Port = portNumber } - if err != nil { - return nil, err - } - return conf, nil }