Skip to content

Commit 6998f02

Browse files
Merge pull request #435 from DevLoversTeam/fix/redis-indent
fix(redis): fix indentation in getRedisClient
2 parents ed04413 + c262b72 commit 6998f02

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

frontend/lib/redis.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
import { Redis } from '@upstash/redis';
22

3-
import { getServerEnv } from '@/lib/env';
3+
import { readServerEnv } from '@/lib/env/server-env';
44

55
let cachedRedis: Redis | null = null;
66

77
export function getRedisClient() {
88
if (cachedRedis) return cachedRedis;
99

10-
const { UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN } = getServerEnv();
10+
const UPSTASH_REDIS_REST_URL = readServerEnv('UPSTASH_REDIS_REST_URL');
11+
const UPSTASH_REDIS_REST_TOKEN = readServerEnv('UPSTASH_REDIS_REST_TOKEN');
12+
1113
if (!UPSTASH_REDIS_REST_URL || !UPSTASH_REDIS_REST_TOKEN) {
1214
return null;
1315
}
1416

17+
try {
18+
new URL(UPSTASH_REDIS_REST_URL);
19+
} catch {
20+
return null;
21+
}
22+
1523
cachedRedis = new Redis({
1624
url: UPSTASH_REDIS_REST_URL,
1725
token: UPSTASH_REDIS_REST_TOKEN,

0 commit comments

Comments
 (0)