- feat(storage): provider_settings table (provider, enabled, api_key, contact);
migration 0007 for both drivers. A provider with no row, or turned off, is
never contacted
- feat(providers): a service that validates and applies settings: a Last.fm key
is 32 hexadecimal characters, enabling a provider that needs a key without
one is refused, clearing the key turns the provider off, a contact cannot
contain parentheses or control characters. Each provider states what it sends
and under which terms, and what it never sends
- feat(api): admin-only GET /providers and PUT /providers/{name}. The API key is
write-only: responses carry only has_api_key, errors never repeat it and the
request log never contains it (tested)
- feat(providers/outbound): the only way Sonda talks to the outside: plain GET
with an identifiable User-Agent, no cookies, no Referer, no Authorization, no
redirects, bounded answers, a timeout per attempt, a minimum interval between
requests, retries with exponential backoff that honour Retry-After without
waiting past the caller's deadline or for an absurd time, and a circuit
breaker that makes a failing provider fail fast
- feat(providers): UserAgent builds "Sonda/version ( contact )" as MusicBrainz
asks, defaulting to the project address so no personal address is sent
- breaking(config): providers.lastfm and SONDA_LASTFM_API_KEY are gone; an old
config, or the variable, fails with a hint instead of being ignored
- docs: OpenAPI operations and schemas, README section on the providers and on
what leaves the server
- test: fake servers and a fake clock only; no network in the suite
11 lines
508 B
SQL
11 lines
508 B
SQL
-- Settings of the external providers (Last.fm, MusicBrainz). A provider with no
|
|
-- row, or with enabled = 0, is never contacted. The API key is stored as given
|
|
-- and is never returned by the API.
|
|
|
|
CREATE TABLE provider_settings (
|
|
provider TEXT PRIMARY KEY,
|
|
enabled INTEGER NOT NULL DEFAULT 0,
|
|
api_key TEXT NOT NULL DEFAULT '',
|
|
contact TEXT NOT NULL DEFAULT '', -- goes into the User-Agent; '' = the project address
|
|
updated_at INTEGER NOT NULL -- unix seconds
|
|
);
|