Finalize first Python release
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
||||
"""Application package for the Python rewrite skeleton."""
|
||||
"""Application package for the home automation backend."""
|
||||
|
||||
|
||||
+4
-3
@@ -15,7 +15,7 @@ from app.api.routes.poo import router as poo_router
|
||||
from app.api.routes.ticktick import router as ticktick_router
|
||||
from app.config import get_settings
|
||||
from app.services.auth import AuthBootstrapError, initialize_auth_schema
|
||||
from app.services.config_page import seed_missing_config_from_bootstrap
|
||||
from app.services.config_page import seed_missing_config_from_bootstrap, sync_app_hostname_from_bootstrap
|
||||
from scripts.app_db_adopt import AppDatabaseAdoptionError, validate_app_runtime_db
|
||||
from scripts.location_db_adopt import LocationDatabaseAdoptionError, validate_location_runtime_db
|
||||
from scripts.poo_db_adopt import PooDatabaseAdoptionError, validate_poo_runtime_db
|
||||
@@ -28,6 +28,7 @@ def ensure_auth_db_ready() -> None:
|
||||
validate_app_runtime_db(get_settings().app_database_url)
|
||||
initialize_auth_schema(session, get_settings())
|
||||
seed_missing_config_from_bootstrap(session, get_settings())
|
||||
sync_app_hostname_from_bootstrap(session, get_settings())
|
||||
except AppDatabaseAdoptionError as exc:
|
||||
raise RuntimeError(str(exc)) from exc
|
||||
except AuthBootstrapError as exc:
|
||||
@@ -82,8 +83,8 @@ def create_app() -> FastAPI:
|
||||
version="0.1.0",
|
||||
lifespan=lifespan,
|
||||
description=(
|
||||
"Python rewrite skeleton for the home automation backend. "
|
||||
"This stage provides only the foundation for future module migration."
|
||||
"Home automation backend with auth, runtime config, Home Assistant "
|
||||
"integrations, TickTick integration, and SQLite-backed recorders."
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -109,6 +109,18 @@ def seed_missing_config_from_bootstrap(session: Session, bootstrap_settings: Set
|
||||
_persist_config_values(session, {**current_values, **missing_values})
|
||||
|
||||
|
||||
def sync_app_hostname_from_bootstrap(session: Session, bootstrap_settings: Settings) -> None:
|
||||
current_values = _read_config_values(session)
|
||||
bootstrap_hostname = _stringify(bootstrap_settings.app_hostname)
|
||||
if current_values.get("APP_HOSTNAME") == bootstrap_hostname:
|
||||
return
|
||||
|
||||
current_values["APP_HOSTNAME"] = bootstrap_hostname
|
||||
_persist_config_values(session, current_values)
|
||||
get_settings.cache_clear()
|
||||
reset_auth_db_caches()
|
||||
|
||||
|
||||
def build_runtime_settings(session: Session, bootstrap_settings: Settings) -> Settings:
|
||||
overrides = _read_config_values(session)
|
||||
if not overrides:
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}{{ app_name }}{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', path='styles.css') }}">
|
||||
<link rel="icon" href="data:,">
|
||||
<link rel="stylesheet" href="/static/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<main class="shell">
|
||||
|
||||
Reference in New Issue
Block a user