mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 17:50:54 +00:00
34 lines
1023 B
TypeScript
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();
|