From 9c643fb2a3395e38798f330234eed1ba2b8850c1 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Thu, 15 Jun 2023 16:21:51 -0700 Subject: [PATCH] fix: :bug: sonic logged connection despite not existing --- packages/backend/src/db/sonic.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/db/sonic.ts b/packages/backend/src/db/sonic.ts index 590c47924..032982f08 100644 --- a/packages/backend/src/db/sonic.ts +++ b/packages/backend/src/db/sonic.ts @@ -5,8 +5,6 @@ import config from "@/config/index.js"; const logger = dbLogger.createSubLogger("sonic", "gray", false); -logger.info("Connecting to Sonic"); - const handlers = (type: string): SonicChannel.Handlers => ({ connected: () => { logger.succ(`Connected to Sonic ${type}`); @@ -28,6 +26,10 @@ const handlers = (type: string): SonicChannel.Handlers => ({ const hasConfig = config.sonic && (config.sonic.host || config.sonic.port || config.sonic.auth); +if (hasConfig) { + logger.info("Connecting to Sonic"); +} + const host = hasConfig ? config.sonic.host ?? "localhost" : ""; const port = hasConfig ? config.sonic.port ?? 1491 : 0; const auth = hasConfig ? config.sonic.auth ?? "SecretPassword" : "";