Refactor backend auth, setup, router, and runtime state handling
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user