Skip to content

Commit

Permalink
Fix config issue with error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzofenix committed Jun 11, 2024
1 parent b837d95 commit 1c20129
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/autoscaler/metricsforwarder/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -100,10 +103,6 @@ func LoadConfig(reader io.Reader) (*Config, error) {
conf.Server.Port = portNumber
}

if err != nil {
return nil, err
}

return conf, nil
}

Expand Down

0 comments on commit 1c20129

Please sign in to comment.