feat: add sondad server with config, storage, auth and listening API
- feat(config): TOML config with env overrides, strict parsing and validation - feat(storage): SQLite (modernc) and PostgreSQL (pgx) backends through bun, embedded per-driver SQL migrations with a transactional runner - feat(schema): catalog tables (artists, albums, tracks, audio_files with per-root paths), users and listening events with idempotency keys - feat(auth): Argon2id password hashing, HS256 JWT tokens, first-user-only registration and login - feat(api): gin REST API under /api/v1 (health, register, login, listens) with a consistent error envelope, body limit and request logging - feat(sondad): zap logger, graceful shutdown, composition root in main - chore: example config, .gitignore for secrets, DB files, IDE and agent files
This commit is contained in:
commit
3a739dc3ae
1 changed files with 2739 additions and 0 deletions
25
sonda.example.toml
Normal file
25
sonda.example.toml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# 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
|
||||
|
||||
[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
|
||||
token_ttl_hours = 168 # one week
|
||||
|
||||
[providers.lastfm]
|
||||
api_key = ""
|
||||
Loading…
Reference in a new issue