Skip to content

Commit f6c1f76

Browse files
authored
Fix error handling order
1 parent 8d0f31f commit f6c1f76

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/config/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ func GetConfig() *Config {
9393
}
9494

9595
cfg, err := ParseConfig(v)
96+
if err != nil {
97+
log.Fatalf("Error in parse config %v", err)
98+
}
99+
96100
envPort := os.Getenv("PORT")
97101
if envPort != "" {
98102
cfg.Server.ExternalPort = envPort
@@ -101,9 +105,6 @@ func GetConfig() *Config {
101105
cfg.Server.ExternalPort = cfg.Server.InternalPort
102106
log.Printf("Environment variable PORT not set; using internal port value -> %s", cfg.Server.ExternalPort)
103107
}
104-
if err != nil {
105-
log.Fatalf("Error in parse config %v", err)
106-
}
107108

108109
return cfg
109110
}

0 commit comments

Comments
 (0)