Recent FPA posts supply the next youth camp, so a call-up is not a one-off list. Tonight's Portugal–Spain under-19 game can be picked, and Cloud M19 delivers it under Seleções Nacionais/M19.
31 lines
996 B
TypeScript
31 lines
996 B
TypeScript
import { ensureCloudM19Target } from "./delivery/fpa-m19.js";
|
|
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, config.API_DB_POOL_SIZE);
|
|
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"));
|
|
|
|
ensureCloudM19Target(db).catch((err) => app.log.warn({ err }, "delivery: Cloud M19 profile not created"));
|
|
|
|
try {
|
|
await app.listen({ port: config.PORT, host: "0.0.0.0" });
|
|
} catch (err) {
|
|
app.log.error(err);
|
|
process.exit(1);
|
|
}
|