Refactor backend auth, setup, router, and runtime state handling

This commit is contained in:
2026-04-10 21:00:36 +02:00
parent 3371ff8324
commit f61d497e4e
4 changed files with 33 additions and 24 deletions

View File

@@ -15,6 +15,11 @@ from typing import TYPE_CHECKING, Any
from starlette.datastructures import State
try:
from unittest.mock import Mock as _Mock
except ImportError: # pragma: no cover
_Mock = None
from app.models.config import PendingRecovery
from app.models.server import ServerStatus
@@ -99,6 +104,8 @@ def get_app_settings(app: Any) -> Settings:
def get_effective_settings(app: Any) -> Settings:
"""Return the effective settings for the current application instance."""
runtime_settings = getattr(app.state, "runtime_settings", None)
if runtime_settings is not None and _Mock is not None and isinstance(runtime_settings, _Mock):
return get_app_settings(app)
if runtime_settings is not None:
return runtime_settings
return get_app_settings(app)