- FastAPI-Backend mit vollständiger ABS v2.x API-Kompatibilität - SQLAlchemy-Models: User, Library, LibraryItem, BookFile, Chapter, Podcast, PodcastEpisode, MediaProgress, Bookmark, PlaybackSession - Auth: JWT-Login (/login, /logout, /api/authorize) - Library + Items Endpoints inkl. camelCase ABS-Response-Format - HLS-Streaming via FFmpeg (POST /api/items/:id/play, Session-Sync) - Me/Progress Endpoints + Lesezeichen - User-Management + Server-Settings (Admin) - Library-Scanner (MP3/WAV Discovery, Hintergrund-Task) - File Watcher (watchdog, 30s Debounce) - Matching-Skelett (MusicBrainz, OpenLibrary, Google Books – Phase 5) - Docker-Setup: backend (Python 3.12+FFmpeg), frontend (React/Vite), nginx Reverse-Proxy auf Port 3000 - setup.sh: Installiert Docker auf Debian/Ubuntu, richtet .env ein Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
971 B
Python
35 lines
971 B
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
# Server
|
|
server_port: int = 3000
|
|
jwt_secret: str = "change_me_in_production"
|
|
jwt_algorithm: str = "HS256"
|
|
jwt_expire_days: int = 365 # ABS verwendet sehr lange Token-Laufzeiten
|
|
|
|
# Admin
|
|
admin_username: str = "admin"
|
|
admin_password: str = "changeme"
|
|
admin_email: str = "admin@example.com"
|
|
|
|
# Paths
|
|
audiofiles_path: str = "/audiofiles"
|
|
database_url: str = "sqlite+aiosqlite:////app/data/db/audiolib.db"
|
|
hls_cache_dir: str = "/app/data/hls_cache"
|
|
covers_dir: str = "/app/data/covers"
|
|
log_dir: str = "/app/data/logs"
|
|
|
|
# Matching
|
|
auto_match_books: bool = True
|
|
auto_match_podcasts: bool = True
|
|
podcast_update_interval_hours: int = 24
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|