48e3418c7f
First ingest path beyond manual upload (plan §1C). Source abstraction +
the first concrete backend, so a homelab can index an existing library.
- domain: SourceBackend/IndexableSource ports + SourceInfo/SourceFile shapes
- infrastructure/sources: LocalFolderSource (walks a mounted dir, idempotent
source_id = relative path) + registry built from settings
- application: LibraryImportService — batch sibling of UploadService; dedup on
(source, source_id), copy into storage, minimal track (metadata_status=pending,
enrichment fills the rest in 1D), per-file failures isolated
- workers: scan_local_folder arq task (registered) + enqueue helper (503 if
Redis down)
- api: GET /sources, POST /sources/{source}/scan (admin, enqueues), /health
- config: LOCAL_MEDIA_IMPORT_PATH; README + .env.example documented
- tests: scanner, registry, import service (fakes) + DB-gated sources API path
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.3 KiB
Bash
39 lines
1.3 KiB
Bash
# Copy to .env and adjust. Never commit real secrets.
|
|
|
|
# runtime
|
|
ENVIRONMENT=dev # dev | test | prod
|
|
LOG_LEVEL=INFO
|
|
LOG_JSON=false # true in prod
|
|
|
|
# database (async driver required)
|
|
DATABASE_URL=postgresql+asyncpg://mcma:mcma@localhost:5432/mcma
|
|
DB_ECHO=false
|
|
|
|
# redis (cache + arq broker)
|
|
REDIS_URL=redis://localhost:6379/0
|
|
|
|
# auth — GENERATE a strong secret for prod: `openssl rand -hex 32`
|
|
JWT_SECRET=change-me-in-prod
|
|
ACCESS_TOKEN_TTL_SECONDS=900
|
|
REFRESH_TOKEN_TTL_SECONDS=2592000
|
|
|
|
# subsonic — key that encrypts per-user Subsonic app-passwords at rest.
|
|
# GENERATE a strong secret for prod (`openssl rand -hex 32`); rotating it
|
|
# invalidates all stored app-passwords. NOTE: /rest must be served over HTTPS.
|
|
SUBSONIC_SECRET_KEY=change-me-subsonic-key
|
|
|
|
# media / storage
|
|
MEDIA_PATH=/data/media
|
|
TRANSCODE_CACHE_PATH=/data/transcode-cache
|
|
MAX_PARALLEL_DOWNLOADS=2
|
|
|
|
# sources — mounted folder the `local` source indexes (copies into MEDIA_PATH).
|
|
# Unset → the local source is not registered. Mount read-only in compose.
|
|
# LOCAL_MEDIA_IMPORT_PATH=/import
|
|
|
|
# external services (all optional — backend degrades gracefully if unset)
|
|
# ML_SERVICE_URL=http://ml:9000
|
|
# ACOUSTID_API_KEY=
|
|
MUSICBRAINZ_USER_AGENT=mcma-backend/0.1.0 ( https://github.com/your/repo )
|
|
# YOUTUBE_COOKIES_PATH=/data/cookies.txt
|