Skip to content

Commit

Permalink
fix: initialize redis if env vars are set
Browse files Browse the repository at this point in the history
  • Loading branch information
CahidArda committed Oct 21, 2024
1 parent 368d650 commit f082839
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>) : process.env;
return environment.UPSTASH_REDIS_REST_URL && environment.UPSTASH_REDIS_REST_TOKEN
? Redis.fromEnv()
: undefined;
};

/**
Expand Down

0 comments on commit f082839

Please sign in to comment.