Phase 2: Docker and OIDC auth
This commit is contained in:
@@ -7,11 +7,16 @@ JELLYFIN_URL etc. are picked up directly without nested-model complications.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
from media_library_viewer_api.logging_utils import describe_settings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Flat application settings read from env vars / .env file."""
|
||||
@@ -21,6 +26,31 @@ class Settings(BaseSettings):
|
||||
jellyfin_api_key: str = ""
|
||||
jellyfin_user_id: str = ""
|
||||
|
||||
# Jellyseerr (optional)
|
||||
jellyseerr_url: str = ""
|
||||
jellyseerr_api_key: str = ""
|
||||
|
||||
# Logging
|
||||
log_level: str = "INFO"
|
||||
|
||||
# Auth / OIDC (Authentik-compatible JWT validation)
|
||||
auth_enabled: bool = False
|
||||
oidc_issuer_url: str = ""
|
||||
oidc_audience: str = ""
|
||||
oidc_jwks_url: str = ""
|
||||
oidc_clock_skew_seconds: int = 30
|
||||
|
||||
# SMTP (optional, used for Users -> message popup)
|
||||
smtp_host: str = ""
|
||||
smtp_port: int = 587
|
||||
smtp_username: str = ""
|
||||
smtp_password: str = ""
|
||||
smtp_from_address: str = ""
|
||||
smtp_from_name: str = "Media Library Viewer"
|
||||
smtp_use_tls: bool = True
|
||||
smtp_use_ssl: bool = False
|
||||
smtp_timeout: int = 30
|
||||
|
||||
# SSH
|
||||
ssh_host: str = ""
|
||||
ssh_username: str = ""
|
||||
@@ -61,6 +91,10 @@ def _find_env_file() -> str | None:
|
||||
def get_settings() -> Settings:
|
||||
"""Return a cached Settings instance."""
|
||||
env_file = _find_env_file()
|
||||
if env_file:
|
||||
return Settings(_env_file=env_file)
|
||||
return Settings()
|
||||
settings = Settings(_env_file=env_file) if env_file else Settings()
|
||||
logger.info(
|
||||
"Loaded backend settings from %s: %s",
|
||||
env_file or "environment/defaults",
|
||||
describe_settings(settings),
|
||||
)
|
||||
return settings
|
||||
|
||||
Reference in New Issue
Block a user