Skip to content

Commit 32fb4a5

Browse files
committed
Fix issue with setting default port
1 parent de06aa1 commit 32fb4a5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ type Config struct {
3333
} `yaml:"standard_urls"`
3434

3535
ServerConfig struct {
36-
Port int `yaml:"port" default:"8080"`
37-
Host string `yaml:"host" default:""`
36+
Port int `yaml:"port"`
37+
Host string `yaml:"host"`
3838
} `yaml:"server_config"`
3939
}
4040

@@ -246,5 +246,9 @@ func loadConfig(filePath string) (Config, error) {
246246
return Config{}, fmt.Errorf("failed to decode YAML file: %w", err)
247247
}
248248

249+
if config.ServerConfig.Port == 0 {
250+
config.ServerConfig.Port = 8080 // Default port if not specified
251+
}
252+
249253
return config, nil
250254
}

0 commit comments

Comments
 (0)