From f082839a48aff85524fddd0d279661c501965a4c Mon Sep 17 00:00:00 2001 From: CahidArda Date: Mon, 21 Oct 2024 21:12:12 +0300 Subject: [PATCH] fix: initialize redis if env vars are set --- src/config.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config.ts b/src/config.ts index 0e38904..735ff09 100644 --- a/src/config.ts +++ b/src/config.ts @@ -48,11 +48,10 @@ export class Config { * and returns undefined, allowing RAG CHAT to fall back to using an in-memory database. */ const initializeRedis = () => { - try { - return Redis.fromEnv(); - } catch { - return; - } + const environment = typeof process === "undefined" ? ({} as Record) : process.env; + return environment.UPSTASH_REDIS_REST_URL && environment.UPSTASH_REDIS_REST_TOKEN + ? Redis.fromEnv() + : undefined; }; /**