Files
dd0c/products/06-runbook-automation/saas/src/index.ts
Max Mayfield 5bad2481ae
Some checks failed
CI — P2 Drift (Go + Node) / saas (push) Successful in 34s
CI — P2 Drift (Go + Node) / build-push (push) Failing after 4s
CI — P3 Alert / build-push (push) Failing after 3s
CI — P6 Run / saas (push) Successful in 23s
CI — P4 Portal / build-push (push) Failing after 2s
CI — P2 Drift (Go + Node) / agent (push) Successful in 17s
CI — P3 Alert / test (push) Successful in 21s
CI — P5 Cost / test (push) Successful in 24s
CI — P4 Portal / test (push) Successful in 38s
CI — P5 Cost / build-push (push) Failing after 3s
CI — P6 Run / build-push (push) Failing after 2s
Add /version endpoint to all products + BUILD_SHA/BUILD_TIME in Dockerfiles
2026-03-02 13:53:15 +00:00

39 lines
1.3 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' }));
app.get('/version', async () => ({ version: process.env.BUILD_SHA || 'dev', built: process.env.BUILD_TIME || 'unknown' }));
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