Skip to content

Commit

Permalink
Merge pull request #281 from drift-labs/jack/env-clients
Browse files Browse the repository at this point in the history
chore: null checks
  • Loading branch information
jackwaller authored Nov 21, 2024
2 parents 3682cbf + e4a78db commit 1fbcc74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/serverLite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1fbcc74

Please sign in to comment.