- 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
29 lines
1.1 KiB
TOML
29 lines
1.1 KiB
TOML
# Copy to sonda.toml and adjust. sonda.toml is git-ignored.
|
|
# Precedence: defaults < this file < environment variables
|
|
# (SONDA_ENV, SONDA_LISTEN, SONDA_DB_DRIVER, SONDA_DB_PATH, SONDA_DB_DSN,
|
|
# SONDA_JWT_SECRET).
|
|
|
|
[server]
|
|
listen = "127.0.0.1:8080" # localhost by default
|
|
|
|
# Libraries (name + directory) are managed through the API: POST /api/v1/libraries.
|
|
[library]
|
|
scan_workers = 4 # parallel tag readers during a scan
|
|
|
|
[database]
|
|
driver = "sqlite" # "sqlite" or "postgres"
|
|
path = "sonda.db" # sqlite only
|
|
dsn = "" # postgres only, e.g. "postgres://user:pass@localhost:5432/sonda?sslmode=disable"
|
|
|
|
[log]
|
|
env = "production" # "dev" or "production"
|
|
|
|
[auth]
|
|
jwt_secret = "" # required, 32+ chars: openssl rand -hex 32
|
|
access_ttl_minutes = 15 # lifetime of an access token
|
|
refresh_ttl_hours = 720 # lifetime of a refresh token (30 days)
|
|
|
|
[listening]
|
|
min_listen_seconds = 20 # a play counts as a listen after this long, or when it completes
|
|
|
|
# Last.fm and MusicBrainz are set up through the API, not here: PUT /api/v1/providers/{name}.
|