Skip to content

Commit

Permalink
Don't initialize Redis if no credentials
Browse files Browse the repository at this point in the history
Fixes #1393
  • Loading branch information
benvinegar committed Nov 23, 2023
1 parent 38281c1 commit 0557f19
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ import { UPSPLASH_TOKEN, UPSPLASH_URL } from '$env/static/private';

export const cache_status = UPSPLASH_URL || UPSPLASH_TOKEN ? 'ONLINE' : 'OFFLINE';

export const redis = new Redis({
url: UPSPLASH_URL,
token: UPSPLASH_TOKEN
});
export const redis =
cache_status == 'ONLINE'
? new Redis({
url: UPSPLASH_URL,
token: UPSPLASH_TOKEN
})
: null;

console.log(`🤓 Cache Status... ${cache_status}`);

Expand Down

0 comments on commit 0557f19

Please sign in to comment.