Skip to content

Commit

Permalink
fix: read env vars before post process the config
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoern-m committed Aug 7, 2024
1 parent 2dbb527 commit 91dc896
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ func Load(cfgFile *string) (*Config, error) {
return nil, fmt.Errorf("failed to unmarshal config: %w", err)
}

err = c.PostProcess()
err = envconfig.Process("", c)
if err != nil {
return nil, fmt.Errorf("failed to post process config: %w", err)
return nil, fmt.Errorf("failed to load config from env vars: %w", err)
}

if err := envconfig.Process("", c); err != nil {
return nil, fmt.Errorf("failed to load config from env vars: %w", err)
err = c.PostProcess()
if err != nil {
return nil, fmt.Errorf("failed to post process config: %w", err)
}

if err = c.Validate(); err != nil {
Expand Down

0 comments on commit 91dc896

Please sign in to comment.