job-search no longer has a fetch command. Its subcommands are now in cmd/fetcher, which reads the same configuration: "fetcher service" runs every enabled source's fetcher on its interval until stopped, and "fetcher fts-once" (was "fetch once") fetches from Find a Tender once and prints the releases as JSON. The new namea say what the commands do, because service runs every source while fts-once fetches only from Find a Tender. The code stays in internal/cli/fetch, where NewCommands replaces the fetch parent command. once.go is now fts_once.go and commandOnce is commandFTSOnce. The README's usage, the config README and the find_a_tender api_root comment now give the new command names.
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package config
|
|
|
|
import "reflect"
|
|
|
|
// JSCKSourceFindATender is the Find a Tender source's configuration key.
|
|
const JSCKSourceFindATender string = "find_a_tender"
|
|
|
|
// JSCSourceFindATender configures fetching from the Find a Tender
|
|
// OCDS API at APIRoot. Empty: the source fails to start if it is enabled,
|
|
// and `fetcher fts-once` fails.
|
|
type JSCSourceFindATender struct {
|
|
JSCSourcesSource
|
|
APIRoot string `cfg:"api_root" default:"https://www.find-tender.service.gov.uk/api/1.0"`
|
|
}
|
|
|
|
// ---------- Section methods (see Section) ----------
|
|
|
|
// Map implements Section.
|
|
func (c JSCSourceFindATender) Map() map[string]any { return mapOf(c) }
|
|
|
|
// Flatten implements Section.
|
|
func (c JSCSourceFindATender) Flatten() map[string]any {
|
|
return flattenOf(JSCKSourceFindATender, c)
|
|
}
|
|
|
|
// TypeOf implements Section.
|
|
func (c JSCSourceFindATender) TypeOf(key string) (reflect.Kind, error) {
|
|
return typeOf(c, key)
|
|
}
|
|
|
|
// ValueOf implements Section.
|
|
func (c JSCSourceFindATender) ValueOf(key string) (any, error) {
|
|
return valueOf(c, key)
|
|
}
|
|
|
|
// SetValue implements Section.
|
|
func (c *JSCSourceFindATender) SetValue(key string, value any) error {
|
|
return setValue(c, key, value)
|
|
}
|