Files
MeshBot/src/main.ts
T
kamilkrzywdaandOpenCode 25f99f04ad
CI / build + unit (pull_request) Successful in 46s
Remove insecure NODE_TLS_REJECT_UNAUTHORIZED=0 TLS workaround
The MeshMonitor gateway uses a valid Let's Encrypt certificate, so
standard TLS certificate verification already works — no workaround
needed. The flag was a security downgrade: it disabled cert verification
for ALL outbound connections in the container (including the LLM and
opencode services), not just the gateway.

- docker-compose.yml: drop NODE_TLS_REJECT_UNAUTHORIZED env line + comment
- src/main.ts: drop process.env.NODE_TLS_REJECT_UNAUTHORIZED + comments
- CHANGELOG.md: correct the v0.22.0 Docker bullet wording

Part of the already-open MeshMonitor connection work (PR #56): no version
bump, no new changelog section.

Co-Authored-By: OpenCode <noreply@opencode.ai>
2026-10-13 01:07:36 +00:00

34 lines
1.3 KiB
TypeScript

import { NestFactory } from '@nestjs/core';
import type { NestExpressApplication } from '@nestjs/platform-express';
import type { RequestHandler } from 'express';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { apiReference } from '@scalar/nestjs-api-reference';
import * as pkg from '../package.json';
import { AppModule } from './app.module.js';
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
app.enableShutdownHooks();
// 'mcp' is excluded so the MCP endpoint lives at /mcp, not /api/mcp (like Scalar at /)
app.setGlobalPrefix('api', { exclude: ['mcp'] });
// Scalar API docs at / (OpenAPI JSON at /docs-json), outside the api prefix.
const docConfig = new DocumentBuilder()
.setTitle('MeshBot API')
.setDescription(
'Meshtastic bridge bot: status, send text messages, list device channels and known nodes.',
)
.addTag('Mesh', 'Meshtastic bridge control and telemetry')
.setVersion(pkg.version)
.build();
const document = SwaggerModule.createDocument(app, docConfig);
const http = app.getHttpAdapter().getInstance();
http.get('/docs-json', (_req, res) => {
res.json(document);
});
http.get('/', apiReference({ url: '/docs-json' }) as RequestHandler);
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();