fix: sync config to settings instead of calling non-existent reload method

- Remove settings.reload() call which doesn't exist in Pydantic BaseSettings
- Manually sync anime_directory and NFO settings from config.json to settings object
- Mirrors the sync logic used in fastapi_app.py lifespan
- Fixes AttributeError: 'Settings' object has no attribute 'reload'
This commit is contained in:
2026-01-23 14:41:06 +01:00
parent 50e0b21669
commit 4c606faa0e

View File

@@ -120,13 +120,27 @@ async def setup_auth(req: SetupRequest):
# Perform initial setup (series sync, NFO scan, media scan)
# This ensures everything is initialized immediately after setup
# without requiring an application restart
# Reload settings to pick up the new configuration
from src.config.settings import settings
from src.server.services.initialization_service import (
perform_initial_setup,
perform_nfo_scan_if_needed,
)
settings.reload()
# Sync config.json values to settings object
# (mirroring the logic in fastapi_app.py lifespan)
other_settings = dict(config.other) if config.other else {}
if other_settings.get("anime_directory"):
settings.anime_directory = str(other_settings["anime_directory"])
if config.nfo:
if config.nfo.tmdb_api_key:
settings.tmdb_api_key = config.nfo.tmdb_api_key
settings.nfo_auto_create = config.nfo.auto_create
settings.nfo_update_on_scan = config.nfo.update_on_scan
settings.nfo_download_poster = config.nfo.download_poster
settings.nfo_download_logo = config.nfo.download_logo
settings.nfo_download_fanart = config.nfo.download_fanart
settings.nfo_image_size = config.nfo.image_size
# Perform the initial series sync and mark as completed
await perform_initial_setup()