From 8a28592fbd982548a281b8bea1edfa2dbd085600 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Wed, 28 Jun 2023 02:44:16 -0400 Subject: [PATCH] fix: disable redis tls if undefined in config --- packages/backend/src/config/types.ts | 4 ++-- packages/backend/src/db/postgre.ts | 4 ++-- packages/backend/src/db/redis.ts | 2 +- packages/backend/src/queue/initialize.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index cbe27543b..84808413c 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -20,11 +20,11 @@ export type Source = { host: string; port: number; family?: number; - pass: string; + pass?: string; db?: number; prefix?: string; user?: string; - tls?: { [x: string]: string }; + tls?: { [y: string]: string }; }; elasticsearch: { host: string; diff --git a/packages/backend/src/db/postgre.ts b/packages/backend/src/db/postgre.ts index 1ba226a8e..89b7a7bf6 100644 --- a/packages/backend/src/db/postgre.ts +++ b/packages/backend/src/db/postgre.ts @@ -207,11 +207,11 @@ export const db = new DataSource({ host: config.redis.host, port: config.redis.port, family: config.redis.family == null ? 0 : config.redis.family, - user: config.redis.user ?? "default", + username: config.redis.user ?? "default", password: config.redis.pass, keyPrefix: `${config.redis.prefix}:query:`, db: config.redis.db || 0, - tls: config.redis.tls || {}, + tls: config.redis.tls, }, } : false, diff --git a/packages/backend/src/db/redis.ts b/packages/backend/src/db/redis.ts index 24563661e..a1f3279f3 100644 --- a/packages/backend/src/db/redis.ts +++ b/packages/backend/src/db/redis.ts @@ -10,7 +10,7 @@ export function createConnection() { username: config.redis.user ?? "default", keyPrefix: `${config.redis.prefix}:`, db: config.redis.db || 0, - tls: config.redis.tls || {}, + tls: config.redis.tls, }); } diff --git a/packages/backend/src/queue/initialize.ts b/packages/backend/src/queue/initialize.ts index 8d728df5b..16e623d13 100644 --- a/packages/backend/src/queue/initialize.ts +++ b/packages/backend/src/queue/initialize.ts @@ -7,10 +7,10 @@ export function initialize(name: string, limitPerSec = -1) { port: config.redis.port, host: config.redis.host, family: config.redis.family == null ? 0 : config.redis.family, - user: config.redis.user ?? "default", + username: config.redis.user ?? "default", password: config.redis.pass, db: config.redis.db || 0, - tls: config.redis.tls || {}, + tls: config.redis.tls, }, prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : "queue", limiter: