Cap face analysis at what one Node thread can commit, prefer IPv4 so a dead IPv6 route cannot fail the fetch, and leave a photo on the desk when ZeroZero says it is already there. Desktop originals go out one at a time so the app does not freeze on "A enviar…".
28 lines
801 B
TypeScript
28 lines
801 B
TypeScript
import { preferIpv4 } from "./lib/prefer-ipv4.js";
|
|
import { buildApp, reporterFor } from "./app.js";
|
|
import { loadConfig } from "./config.js";
|
|
import { createDb } from "./db.js";
|
|
|
|
preferIpv4();
|
|
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);
|
|
}
|