SPB Git

spb/cancerindex

Public
1.4 KB · 40 lines typescript
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  healthProbe: 'health.probe',31} as const;32export type JobName = (typeof JOBS)[keyof typeof JOBS];3334/** Daily maintenance (UTC): counters after the nightly connector windows, rankings after counters. */35export const SCHEDULES = {36  counters: '0 6 * * *',37  rank: '30 6 * * *',38  healthProbe: '15 * * * *',39} as const;40
Files · 4354e64ec39d7ace4e77b667021fe28e703ed10d
Menu

Theme