import { loadConfig } from "./config.js"; import { startServer, type ServerHandle } from "./start.js"; const config = loadConfig(); // Register signal handlers BEFORE await so SIGTERM during startup exits cleanly let handle: ServerHandle | undefined; const shutdown = () => { (handle?.close() ?? Promise.resolve()).finally(() => process.exit(0)); }; process.on("SIGINT", shutdown); process.on("SIGTERM", shutdown); handle = await startServer(config);