Files
edr-platform/apps/edr-gps-tracker/src/main.ts
yaschalew ab7df584ba gps
2026-07-11 08:36:02 +03:00

34 lines
1023 B
TypeScript

import "reflect-metadata";
import * as dotenv from "dotenv";
dotenv.config();
import { Logger } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
/**
*
* Standalone GT06 GPS ingester. Boots a Nest application context (NO HTTP
* server) so only the DB connection and Gt06Server come up; the TCP listener
* binds from Gt06Server.onApplicationBootstrap. The /gps REST API lives in
* @edr/freight-api, which reads the same tables this process writes.
*/
async function bootstrap() {
const logger = new Logger("gps-tracker");
const port = Number(process.env.GT06_TCP_PORT ?? 5023);
if (!port) {
logger.error(
"GT06_TCP_PORT=0 disables the listener — this process would idle. Set a port.",
);
process.exit(1);
}
const app = await NestFactory.createApplicationContext(AppModule);
app.enableShutdownHooks();
logger.log(
`GT06 ingester up — TCP ${process.env.GT06_TCP_HOST ?? "0.0.0.0"}:${port}`,
);
}
void bootstrap();