We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de06aa1 commit 32fb4a5Copy full SHA for 32fb4a5
main.go
@@ -33,8 +33,8 @@ type Config struct {
33
} `yaml:"standard_urls"`
34
35
ServerConfig struct {
36
- Port int `yaml:"port" default:"8080"`
37
- Host string `yaml:"host" default:""`
+ Port int `yaml:"port"`
+ Host string `yaml:"host"`
38
} `yaml:"server_config"`
39
}
40
@@ -246,5 +246,9 @@ func loadConfig(filePath string) (Config, error) {
246
return Config{}, fmt.Errorf("failed to decode YAML file: %w", err)
247
248
249
+ if config.ServerConfig.Port == 0 {
250
+ config.ServerConfig.Port = 8080 // Default port if not specified
251
+ }
252
+
253
return config, nil
254
0 commit comments