Validate configuration source keys and overrides

This commit is contained in:
2026-08-13 00:15:26 +00:00
parent 5139c1a586
commit 26a681e0b1
7 changed files with 173 additions and 17 deletions

View File

@@ -21,6 +21,33 @@ const (
NotifyFailureError NotifyFailurePolicy = "error"
)
const (
MissingSourceObservations = "observations"
MissingSourceCurrent = "current"
MissingSourceNarrative = "narrative"
MissingSourceAlerts = "alerts"
MissingSourceDiscussion = "discussion"
MissingSourceWeatherStory = "weather_story"
MissingSourceSPCConvectiveOutlooks = "spc_convective_outlooks"
)
var supportedMissingSources = map[string]struct{}{
MissingSourceObservations: {},
MissingSourceCurrent: {},
MissingSourceNarrative: {},
MissingSourceAlerts: {},
MissingSourceDiscussion: {},
MissingSourceWeatherStory: {},
MissingSourceSPCConvectiveOutlooks: {},
}
// IsSupportedMissingSource reports whether source accepts a missing-source
// policy override. Required sources, including hourly, are not configurable.
func IsSupportedMissingSource(source string) bool {
_, ok := supportedMissingSources[source]
return ok
}
type Config struct {
WeatherAPI WeatherAPIConfig `yaml:"weather_api"`
Location LocationConfig `yaml:"location"`
@@ -246,7 +273,11 @@ func (c *ReportDistributorConfig) UnmarshalYAML(value *yaml.Node) error {
}
func (c ReportDistributorConfig) PathTemplatesSet() bool {
return c.pathTemplatesSet
return c.pathTemplatesSet || c.PathTemplates != nil
}
func (c ReportConfig) deterministicModulesConfigured() bool {
return c.deterministicModulesSet || c.DeterministicModules != nil
}
func (m *ModuleConfigItem) UnmarshalYAML(value *yaml.Node) error {