spb/cancerindex
Public
TypeScript 97.2%
SQL 1.5%
CSS 0.6%
JavaScript 0.5%
1/**2 * Imported FIRST by main.ts / cli.ts so that CI_SERVICE and .env values are set before3 * `@cancerindex/shared` creates the pino logger (module-level singleton).4 */5import { existsSync } from 'node:fs';6import path from 'node:path';7import { fileURLToPath } from 'node:url';89const here = path.dirname(fileURLToPath(import.meta.url));10for (const candidate of [path.resolve(here, '../../.env'), path.resolve(process.cwd(), '.env')]) {11 if (!existsSync(candidate)) continue;12 try {13 process.loadEnvFile(candidate);14 } catch {15 /* ignore malformed files */16 }17}18process.env.CI_SERVICE ??= 'worker';1920export const DATABASE_URL = process.env.DATABASE_URL ?? 'postgres://localhost:5432/cancerindex';21export const WORKER_CONCURRENCY = Math.max(1, Number(process.env.WORKER_CONCURRENCY ?? 2) || 2);22export const CI_MAX_RUN_MINUTES = Math.max(1, Number(process.env.CI_MAX_RUN_MINUTES ?? 45) || 45);23export const PGBOSS_SCHEMA = 'pgboss';2425/** Job names — must match apps/api/src/lib/queue.ts. */26export const JOBS = {27 connectorRun: 'connector.run',28 counters: 'maintenance.counters',29 rank: 'maintenance.rank',30 intel: 'maintenance.intel',31 healthProbe: 'health.probe',32} as const;33export type JobName = (typeof JOBS)[keyof typeof JOBS];3435/** Daily maintenance (UTC): counters after the nightly connector windows, rankings after counters. */36export const SCHEDULES = {37 counters: '0 6 * * *',38 intel: '15 6 * * *',39 rank: '30 6 * * *',40 healthProbe: '15 * * * *',41} as const;42