Validate Weather API endpoints and retries
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user