Skip to content

Commit

Permalink
chore: check redis url env when init redis client
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Jul 15, 2022
1 parent 97068b4 commit bfe4959
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion faucet/api/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ export function redis(): { client: Redis | null; error: Error | null } {
return { client: _redis, error: null };
}

if (!process.env.REDIS_CONNECT_URL) {
return { client: null, error: new Error('Failed to get cache client url') };
}

try {
_redis = new Redis(process.env.REDIS_CONNECT_URL || '');
_redis = new Redis(process.env.REDIS_CONNECT_URL);
return { client: _redis, error: null };
} catch (err) {
const error = err as Error;
Expand Down

0 comments on commit bfe4959

Please sign in to comment.