Update ESLint rules, enhance environment schema with new metrics and health port, and refactor Redis import. Change TypeScript definitions path in package.json.

This commit is contained in:
smueller
2026-07-22 11:11:39 +02:00
parent c2271485a5
commit bc97d1d74c
15 changed files with 801 additions and 6 deletions

32
apps/bot/src/health.ts Normal file
View File

@@ -0,0 +1,32 @@
import { createServer } from 'node:http';
import { env } from './env.js';
export function startHealthServer(): void {
const server = createServer((req, res) => {
if (!req.url) {
res.statusCode = 400;
res.end('Bad Request');
return;
}
if (req.url === '/health') {
res.statusCode = 200;
res.end('ok');
return;
}
if (req.url === '/metrics') {
const auth = req.headers.authorization;
if (!env.METRICS_TOKEN || auth !== `Bearer ${env.METRICS_TOKEN}`) {
res.statusCode = 401;
res.end('Unauthorized');
return;
}
res.statusCode = 200;
res.end('# Prometheus metrics scaffold\nnexumi_up 1\n');
return;
}
res.statusCode = 404;
res.end('Not Found');
});
server.listen(env.HEALTH_PORT);
}