This commit is contained in:
natib21
2026-07-07 09:07:28 +00:00
parent 5a7133b599
commit 00c5c4b67b

View File

@@ -31,9 +31,10 @@ export class Gt06Server implements OnApplicationBootstrap, OnModuleDestroy {
this.logger.log('GT06 TCP listener disabled (GT06_TCP_PORT=0)');
return;
}
const host = process.env.GT06_TCP_HOST ?? '0.0.0.0';
this.server = net.createServer((socket) => this.onConnection(socket));
this.server.on('error', (err) => this.logger.error(`GT06 server error: ${String(err)}`));
this.server.listen(port, () => this.logger.log(`GT06 GPS tracker listener on tcp/${port}`));
this.server.listen(port, host, () => this.logger.log(`GT06 GPS tracker listener on ${host}:${port}`));
}
onModuleDestroy(): void {