Updates in preparation for adding forecast sources.

This commit is contained in:
2026-01-16 00:04:37 -06:00
parent e10ba804ca
commit 0fcc536885
6 changed files with 162 additions and 61 deletions

View File

@@ -1,8 +1,6 @@
package sources
import (
"fmt"
"gitea.maximumdirect.net/ejr/weatherfeeder/internal/sources/nws"
"gitea.maximumdirect.net/ejr/weatherfeeder/internal/sources/openmeteo"
"gitea.maximumdirect.net/ejr/weatherfeeder/internal/sources/openweather"
@@ -35,22 +33,3 @@ func RegisterBuiltins(r *fksource.Registry) {
return openweather.NewObservationSource(cfg)
})
}
// Optional: centralize some common config checks used by multiple drivers.
//
// NOTE: feedkit/config.SourceConfig intentionally keeps driver-specific options
// inside cfg.Params, so drivers can evolve independently without feedkit
// importing domain config packages.
func RequireURL(cfg config.SourceConfig) error {
if cfg.Params == nil {
return fmt.Errorf("source %q: params.url is required", cfg.Name)
}
// Canonical key is "url". We also accept "URL" as a convenience.
url, ok := cfg.ParamString("url", "URL")
if !ok {
return fmt.Errorf("source %q: params.url is required", cfg.Name)
}
_ = url // (optional) return it if you want this helper to provide the value
return nil
}