Skip to content

Commit

Permalink
Merge pull request #87 from upstash/fix-ci-test-paths
Browse files Browse the repository at this point in the history
Initialize Redis if Env vars are set
  • Loading branch information
CahidArda authored Oct 22, 2024
2 parents cb61a0b + 3ca5c22 commit 807f751
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 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
1 change: 0 additions & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default defineConfig([
entry: ["src/index.ts"],
outDir: "dist",
format: ["cjs", "esm"],
clean: true,
dts: true,
},
{
Expand Down

0 comments on commit 807f751

Please sign in to comment.