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. RateLimitRetries is how many times a request // refused for the API's rate limit is waited out and retried; 0 fails at the // first, and it can't be negative. type JSCSourceFindATender struct { JSCSourcesSource APIRoot string `cfg:"api_root" default:"https://www.find-tender.service.gov.uk/api/1.0"` RateLimitRetries int `cfg:"rate_limit_retries" default:"5"` } // ---------- 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) } // ---------- Section specific methods ---------- // validate checks values before they are stored (see validator), as // JSCSourcesSource's does, which this one hides. rate_limit_retries can't be // negative. func (c *JSCSourceFindATender) validate(key string, value any) error { return validateRateLimitRetries(&c.JSCSourcesSource, key, value) }