import mysql from "mysql2/promise"; import { loadEnv } from "./config/env.js"; import { buildApp } from "./buildApp.js"; const _env = loadEnv(); const _pool = mysql.createPool({ uri: _env.DATABASE_URL, connectionLimit: 16, waitForConnections: true, enableKeepAlive: true, }); const _app = await buildApp({ env: _env, pool: _pool }); const _close = async () => { await _app.close(); await _pool.end(); }; process.on("SIGINT", () => { void _close().then(() => process.exit(0)); }); process.on("SIGTERM", () => { void _close().then(() => process.exit(0)); }); await _app.listen({ port: _env.PORT, host: "0.0.0.0" }); _app.log.info(`ingest-api listening on ${_env.PORT}`);