generated from john/python-template
V6.1 continue refining backup: switch to Synology Drive Client for remote backup
Quality Gate / gate (push) Failing after 1m10s
Quality Gate / gate (push) Failing after 1m10s
This commit is contained in:
@@ -739,13 +739,23 @@ def register_page(*, settings: Settings) -> None: # noqa: PLR0915
|
||||
title="Runtime settings save failed",
|
||||
action=lambda: _write_runtime_settings(settings=settings, updates=updates),
|
||||
)
|
||||
if not save_outcome.ok:
|
||||
if not save_outcome.ok or save_outcome.value is None:
|
||||
return
|
||||
ui.notify("Runtime settings saved to .env", type="positive")
|
||||
target_path = save_outcome.value.env_file_path
|
||||
ui.notify(
|
||||
f"Runtime settings saved to {target_path}. Restart app/worker to apply.",
|
||||
type="positive",
|
||||
)
|
||||
render_runtime_settings.refresh()
|
||||
|
||||
with ui.row().classes("items-center gap-2 mt-3"):
|
||||
ui.button("Save runtime settings", icon="save", on_click=save_runtime).classes("ui-btn-primary")
|
||||
with ui.column().classes("w-full max-w-3xl mx-auto gap-1 mt-2"):
|
||||
ui.label("Apply saved runtime settings").classes("text-xs font-semibold")
|
||||
ui.label(
|
||||
"Run this on the host from the deployment repo to recreate app/worker with new env values:"
|
||||
).classes("text-[11px] ui-text-muted")
|
||||
ui.code(_runtime_restart_command(), language="bash").classes("w-full text-xs")
|
||||
|
||||
with ui.tabs().classes("w-full") as tabs:
|
||||
document_types_tab = ui.tab("Document Types")
|
||||
@@ -855,3 +865,7 @@ def _format_duration(*, started_at: datetime | None, finished_at: datetime | Non
|
||||
|
||||
async def _read_maintenance_log(*, maintenance: MaintenanceService, log_path: str) -> bytes:
|
||||
return await run_blocking(maintenance.read_log_bytes, log_path=log_path)
|
||||
|
||||
|
||||
def _runtime_restart_command() -> str:
|
||||
return "docker compose -f docker-compose.production.yml up -d --force-recreate app worker"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
from dataclasses import dataclass
|
||||
@@ -366,6 +367,10 @@ def _resolve_env_file_path(*, settings: Settings, env_file_path: Path | None) ->
|
||||
if env_file_path is not None:
|
||||
return env_file_path
|
||||
|
||||
override = os.getenv("RUNTIME_SETTINGS_ENV_FILE", "").strip()
|
||||
if override:
|
||||
return Path(override)
|
||||
|
||||
configured = settings.model_config.get("env_file")
|
||||
if configured is None:
|
||||
return Path(".env")
|
||||
|
||||
Reference in New Issue
Block a user