From 0a36c64bb58f8f4b18d492da12cd8038de2f02a1 Mon Sep 17 00:00:00 2001 From: Haim Kastner Date: Thu, 5 Sep 2024 10:00:25 +0300 Subject: [PATCH] Fix #121 Show SwaggerUI url in logs --- backend/src/index.ts | 3 +++ backend/src/modules/mqtt/mqtt-drivers/casanetMqttDriver.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 51100d53..7d34d1b8 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -23,6 +23,7 @@ import { exec } from 'child-process-promise'; import * as fs from 'fs'; import * as http from 'http'; import * as https from 'https'; +import * as ip from 'ip'; import { Configuration } from './config'; import { logger } from './utilities/logger'; import { app } from './app'; @@ -66,6 +67,7 @@ async function initServices() { logger.info(`[home-iot-server] ------------------- Initializing HTTP server... -------------------`); http.createServer(app).listen(Configuration.http.httpPort, () => { logger.info(`[home-iot-server] ------------------- Initializing HTTP server on port ${Configuration.http.httpPort} succeed -------------------`); + logger.info(`[home-iot-server] ------------------- Swagger UI http:${ip.address()}:${Configuration.http.httpPort}/docs -------------------`); }); // SSL/HTTPS @@ -84,6 +86,7 @@ async function initServices() { https.createServer(sslOptions, app).listen(Configuration.http.httpsPort, () => { logger.info(`[home-iot-server] ------------------- Initializing HTTPS server on port ${Configuration.http.httpPort} succeed -------------------`); + logger.info(`[home-iot-server] ------------------- Swagger UI https:${ip.address()}:${Configuration.http.httpPort}/docs -------------------`); }); } catch (error) { logger.error(`Failed to load SSL certificate ${error}, exit...`); diff --git a/backend/src/modules/mqtt/mqtt-drivers/casanetMqttDriver.ts b/backend/src/modules/mqtt/mqtt-drivers/casanetMqttDriver.ts index a5312bf5..4f0bfe70 100644 --- a/backend/src/modules/mqtt/mqtt-drivers/casanetMqttDriver.ts +++ b/backend/src/modules/mqtt/mqtt-drivers/casanetMqttDriver.ts @@ -41,7 +41,7 @@ export class CasanetMqttDriver extends MqttBaseDriver { public async convertMqttMessage(topic: string, data: string): Promise { const topics = topic.split('/'); - const minionId = topics[1]; + const minionId = topics[2]; const minions = await this.retrieveMinions.pull();