From 9695e9b08a3c9a96ffddea236aa6f3f1a254caf2 Mon Sep 17 00:00:00 2001 From: teernisse Date: Thu, 26 Feb 2026 17:03:14 -0500 Subject: [PATCH] feat(server): add spawn feature startup initialization - Import and call load_projects_cache() to populate cache before requests - Import and call generate_auth_token() to create one-time auth token - Import and call start_projects_watcher() for background cache refresh - Inject auth token into dashboard HTML via placeholder replacement - Add AMC_AUTH_TOKEN placeholder in index.html head --- amc_server/server.py | 9 ++++++++- dashboard/index.html | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/amc_server/server.py b/amc_server/server.py index 2b8efb7..73006cb 100644 --- a/amc_server/server.py +++ b/amc_server/server.py @@ -1,15 +1,22 @@ import os from http.server import ThreadingHTTPServer -from amc_server.context import DATA_DIR, PORT +from amc_server.context import DATA_DIR, PORT, generate_auth_token, start_projects_watcher from amc_server.handler import AMCHandler from amc_server.logging_utils import LOGGER, configure_logging, install_signal_handlers +from amc_server.mixins.spawn import load_projects_cache def main(): configure_logging() DATA_DIR.mkdir(parents=True, exist_ok=True) LOGGER.info("Starting AMC server") + + # Initialize spawn feature + load_projects_cache() + generate_auth_token() + start_projects_watcher() + server = ThreadingHTTPServer(("127.0.0.1", PORT), AMCHandler) install_signal_handlers(server) LOGGER.info("AMC server listening on http://127.0.0.1:%s", PORT) diff --git a/dashboard/index.html b/dashboard/index.html index 0111b79..a34fd58 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -99,6 +99,7 @@ +