From e4a78db77053d4f09d7af5c012bce3085e51315b Mon Sep 17 00:00:00 2001 From: Jack Waller Date: Thu, 21 Nov 2024 13:04:06 -0500 Subject: [PATCH] chore: null checks --- src/index.ts | 4 ++-- src/serverLite.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index a4ebfed..4214c4b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,11 +63,11 @@ setGlobalDispatcher( require('dotenv').config(); const envClients = []; -const clients = process.env.REDIS_CLIENT.trim() +const clients = process.env.REDIS_CLIENT?.trim() .replace(/^\[|\]$/g, '') .split(/\s*,\s*/); -clients.forEach((client) => envClients.push(RedisClientPrefix[client])); +clients?.forEach((client) => envClients.push(RedisClientPrefix[client])); const REDIS_CLIENTS = envClients.length ? envClients : [RedisClientPrefix.DLOB, RedisClientPrefix.DLOB_HELIUS]; console.log('Redis Clients:', REDIS_CLIENTS); diff --git a/src/serverLite.ts b/src/serverLite.ts index 9ab8e30..d2e4024 100644 --- a/src/serverLite.ts +++ b/src/serverLite.ts @@ -39,11 +39,11 @@ require('dotenv').config(); // Reading in Redis env vars const envClients = []; -const clients = process.env.REDIS_CLIENT.trim() +const clients = process.env.REDIS_CLIENT?.trim() .replace(/^\[|\]$/g, '') .split(/\s*,\s*/); -clients.forEach((client) => envClients.push(RedisClientPrefix[client])); +clients?.forEach((client) => envClients.push(RedisClientPrefix[client])); const REDIS_CLIENTS = envClients.length ? envClients : [RedisClientPrefix.DLOB, RedisClientPrefix.DLOB_HELIUS]; console.log('Redis Clients:', REDIS_CLIENTS);