feat(settings): patch API in-memory settings on save and add Back to ENV button
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -38,7 +38,9 @@ _last_seen_version: str = ""
|
||||
|
||||
def notify_settings_updated() -> None:
|
||||
"""
|
||||
Publish a settings-updated signal by updating the Redis version key.
|
||||
Publish a settings-updated signal by updating the Redis version key, and
|
||||
immediately reload the in-process ``settings`` singleton so the API
|
||||
process serves fresh values without a restart.
|
||||
|
||||
Call this after every successful settings write so that all worker
|
||||
processes know they need to reload their in-memory configuration.
|
||||
@@ -56,6 +58,19 @@ def notify_settings_updated() -> None:
|
||||
except Exception as exc:
|
||||
logger.warning(f"Could not publish settings update to Redis: {exc}")
|
||||
|
||||
# Reload the in-process settings singleton immediately so the API node
|
||||
# returns updated values (e.g. oauth_provider_name on the login page)
|
||||
# without needing a restart. Workers use the task_prerun signal handler
|
||||
# instead, so this only affects the API/web process.
|
||||
try:
|
||||
from app.config import settings
|
||||
from app.utils.config_loader import reload_settings_from_db
|
||||
|
||||
reload_settings_from_db(settings)
|
||||
logger.debug("In-process settings reloaded after settings update")
|
||||
except Exception as exc:
|
||||
logger.warning(f"Could not reload in-process settings: {exc}")
|
||||
|
||||
|
||||
def register_settings_reload_signal() -> None:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user