sonda/sonda.example.toml
tgiachi dbe9338af3 feat(auth): add refresh tokens, admin role and user management
- feat(auth): short-lived access tokens plus rotating refresh tokens stored as
  SHA-256 hashes; replaying a spent token revokes every session of that user
- feat(auth): is_admin flag; the first registered user is the admin and the
  last admin can be neither demoted nor deleted
- feat(api): POST /auth/refresh, /auth/logout, /auth/password and GET /auth/me
- feat(api): admin-only GET/POST /users, PATCH /users/{id}, PUT
  /users/{id}/password and DELETE /users/{id}; the admin check reads the role
  from the database on every call
- feat(api): starting a library scan is now admin-only
- feat(storage): users and refresh token repositories for SQLite and
  PostgreSQL (migration 0004; the oldest existing account becomes admin)
- feat(config): auth.access_ttl_minutes and auth.refresh_ttl_hours replace
  auth.token_ttl_hours
- test: rotation, reuse detection, concurrent rotation with a single winner,
  admin rules, role changes taking effect immediately
2026-11-11 12:38:42 +01:00

27 lines
952 B
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, SONDA_LASTFM_API_KEY).
[server]
listen = "127.0.0.1:8080" # localhost by default
[library]
roots = ["/path/to/music"] # read-only, at least one required
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)
[providers.lastfm]
api_key = ""