Files
dd0c/products/06-runbook-automation/saas/src/index.ts
Max Mayfield 27a89ee2b7
Some checks failed
CI — P2 Drift (Go + Node) / agent (push) Failing after 3s
CI — P2 Drift (Go + Node) / saas (push) Successful in 29s
CI — P3 Alert / test (push) Successful in 40s
CI — P4 Portal / test (push) Successful in 32s
CI — P6 Run / saas (push) Successful in 30s
CI — P5 Cost / test (push) Successful in 46s
Trigger CI with tsc fix
2026-03-01 06:56:00 +00:00

38 lines
1.2 KiB
TypeScript

import Fastify from 'fastify';
import cors from '@fastify/cors';
import helmet from '@fastify/helmet';
import pino from 'pino';
import { config } from './config/index.js';
import { pool } from './data/db.js';
import { registerAuth, registerAuthRoutes } from './auth/middleware.js';
import { registerRunbookRoutes } from './api/runbooks.js';
import { registerApprovalRoutes } from './api/approvals.js';
import { registerSlackRoutes } from './slackbot/handler.js';
const logger = pino({ name: 'dd0c-run', level: config.LOG_LEVEL });
const app = Fastify({ logger: true });
await app.register(cors, { origin: config.CORS_ORIGIN });
await app.register(helmet);
registerAuth(app, config.JWT_SECRET, pool);
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-run' }));
registerAuthRoutes(app, config.JWT_SECRET, pool);
registerRunbookRoutes(app);
registerApprovalRoutes(app);
registerSlackRoutes(app);
try {
await app.listen({ port: config.PORT, host: '0.0.0.0' });
logger.info({ port: config.PORT }, 'dd0c/run SaaS started');
} catch (err) {
logger.fatal(err, 'Failed to start');
process.exit(1);
}
// Build: 2026-03-01T06:43:58Z
// CI: 2026-03-01T06:52:14Z
// CI fix: 06:56