From 94cf57cfda398533f6d43632e7255e60a2851217 Mon Sep 17 00:00:00 2001 From: Lars Hampe Date: Tue, 5 Nov 2024 15:59:03 +0100 Subject: [PATCH] ci: redis credentials only on production --- apps/api/src/utils/redis.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/api/src/utils/redis.ts b/apps/api/src/utils/redis.ts index 6bb2c2e..4aaf27b 100644 --- a/apps/api/src/utils/redis.ts +++ b/apps/api/src/utils/redis.ts @@ -1,9 +1,15 @@ import { createClient } from 'redis' -export const redis = createClient({ - password: import.meta.env.REDIS_PASSWORD, - url: import.meta.env.REDIS_URL, -}) +const getRedisOptions = () => { + if (import.meta.env.NODE_ENV !== 'production') { + return { + password: import.meta.env.REDIS_PASSWORD, + url: import.meta.env.REDIS_URL, + } + } + return {} +} +export const redis = createClient(getRedisOptions()) redis.on('error', (err) => console.log('Redis Client Error', err)) await redis.connect()