An enabled Find a Tender or mock source with no api_root used to start and then fail on every fetch. Its worker now returns an error naming the missing key before it starts, which stops Run. "fetch once" checks sources.find_a_tender.api_root the same way. TestRunMissingAPIRoot covers both sources, and TestRunLogsSourceErrors sets an api_root so it still tests the zero interval. The section docs and internal/config/README.md say what an empty api_root means.
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package config
|
|
|
|
import "reflect"
|
|
|
|
// JSCKSourceFTSMock is the Find a Tender mock source's configuration key.
|
|
const JSCKSourceFTSMock string = "fts_mock"
|
|
|
|
// JSCSourceFTSMock configures fetching from a Find a Tender mock
|
|
// server (cmd/mock-fts) at APIRoot, which has no default. Empty: the source
|
|
// fails to start if it is enabled.
|
|
type JSCSourceFTSMock struct {
|
|
JSCSourcesSource
|
|
APIRoot string `cfg:"api_root"`
|
|
}
|
|
|
|
// ---------- Section methods (see Section) ----------
|
|
|
|
// Map implements Section.
|
|
func (c JSCSourceFTSMock) Map() map[string]any { return mapOf(c) }
|
|
|
|
// Flatten implements Section.
|
|
func (c JSCSourceFTSMock) Flatten() map[string]any {
|
|
return flattenOf(JSCKSourceFTSMock, c)
|
|
}
|
|
|
|
// TypeOf implements Section.
|
|
func (c JSCSourceFTSMock) TypeOf(key string) (reflect.Kind, error) {
|
|
return typeOf(c, key)
|
|
}
|
|
|
|
// ValueOf implements Section.
|
|
func (c JSCSourceFTSMock) ValueOf(key string) (any, error) {
|
|
return valueOf(c, key)
|
|
}
|
|
|
|
// SetValue implements Section.
|
|
func (c *JSCSourceFTSMock) SetValue(key string, value any) error {
|
|
return setValue(c, key, value)
|
|
}
|