Validate Weather API endpoints and retries

This commit is contained in:
2026-08-13 00:32:22 +00:00
parent 2d956f7315
commit 3c1ebab289
7 changed files with 125 additions and 12 deletions

View File

@@ -23,6 +23,9 @@ func Validate(cfg Config) error {
if err != nil || parsed.Scheme == "" || parsed.Host == "" {
return fmt.Errorf("weather_api.base_url must be an absolute URL")
}
if !strings.EqualFold(parsed.Scheme, "http") && !strings.EqualFold(parsed.Scheme, "https") {
return fmt.Errorf("weather_api.base_url must use http or https")
}
}
if cfg.WeatherAPI.Timeout <= 0 {
return fmt.Errorf("weather_api.timeout must be greater than zero")