API and worker report error log lines, unhandled 5xx and crashes to the hub with the photoreport ingest key (ERROR_REPORTING_TOKEN); browsers (app, desktop webview, sites), Next server renders and the print agent send through POST /v1/client-errors so the key stays on the server. Repeats folded, rate-limited. docs/errors.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HT6iXLYUUp9pJz5Kza9xCW
26 lines
736 B
TypeScript
26 lines
736 B
TypeScript
import { buildApp, reporterFor } from "./app.js";
|
|
import { loadConfig } from "./config.js";
|
|
import { createDb } from "./db.js";
|
|
|
|
const config = loadConfig();
|
|
const db = createDb(config.DATABASE_URL);
|
|
const reporter = reporterFor(config);
|
|
reporter.watchProcess("api");
|
|
const app = await buildApp({ config, db, realtime: "socket", reporter });
|
|
|
|
const shutdown = async (signal: string) => {
|
|
app.log.info({ signal }, "shutting down");
|
|
await app.close();
|
|
await db.$disconnect();
|
|
process.exit(0);
|
|
};
|
|
process.on("SIGTERM", () => void shutdown("SIGTERM"));
|
|
process.on("SIGINT", () => void shutdown("SIGINT"));
|
|
|
|
try {
|
|
await app.listen({ port: config.PORT, host: "0.0.0.0" });
|
|
} catch (err) {
|
|
app.log.error(err);
|
|
process.exit(1);
|
|
}
|