From 9819f91a500e32a6bca5a44ade180aaedc7f6dd9 Mon Sep 17 00:00:00 2001 From: Abdulkaiz Khatri <24286590+ful1e5@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:38:32 +0530 Subject: [PATCH] fix(redis): connect redis client in production and preview --- src/services/redis.ts | 7 +++++-- src/types/env.d.ts | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/services/redis.ts b/src/services/redis.ts index c2c4ca3..9373b6c 100644 --- a/src/services/redis.ts +++ b/src/services/redis.ts @@ -1,6 +1,9 @@ import Redis from 'ioredis'; -const client = new Redis(); +const client = new Redis({ + host: process.env.REDIS_HOST, + password: process.env.REDIS_PASSWORD, + port: process.env.REDIS_PORT +}); export default client; - diff --git a/src/types/env.d.ts b/src/types/env.d.ts index c51dc1e..6f99380 100644 --- a/src/types/env.d.ts +++ b/src/types/env.d.ts @@ -1,13 +1,15 @@ namespace NodeJS { interface ProcessEnv { readonly VERCEL_ENV: 'preview' | 'development' | 'production'; - readonly NEXT_PUBLIC_VERCEL_URL: string; readonly NEXT_PUBLIC_JWT_SECRET: string; - readonly NEXTAUTH_SECRET: string; readonly FLASK_SECRET: string; - readonly CRON_SECRET: string; + readonly SVG_FETCH_SECRET: string; + + readonly REDIS_HOST?: string; + readonly REDIS_PASSWORD?: string; + readonly REDIS_PORT?: number; readonly GITHUB_ID: string; readonly GITHUB_SECRET: string;