From ea59cab329fee6cc5ab3c1d543f895f5571664b0 Mon Sep 17 00:00:00 2001 From: rharkor Date: Mon, 20 Nov 2023 12:10:52 +0100 Subject: [PATCH] fix: redis tls --- .env.example | 2 -- env.mjs | 2 -- src/lib/redis.ts | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 1e8e28db..816d4813 100644 --- a/.env.example +++ b/.env.example @@ -14,12 +14,10 @@ AUTH_ADMIN_PASSWORD=secret NEXT_PUBLIC_IS_DEMO=false NEXT_PUBLIC_DEMO_EMAIL=test@mail.com NEXT_PUBLIC_DEMO_PASSWORD=Azerty123! -# CHOOSE EITHER REDIS_URL OR REDIS_HOST, REDIS_USERNAME, REDIS_PASSWORD, REDIS_PORT REDIS_HOST=localhost REDIS_USERNAME= REDIS_PASSWORD= REDIS_PORT=6379 -REDIS_URL=redis://localhost:6379 REDIS_USE_TLS=false SMTP_HOST=youtSmptHost SMTP_PORT=465 diff --git a/env.mjs b/env.mjs index abe78a08..e70fdcd3 100644 --- a/env.mjs +++ b/env.mjs @@ -24,7 +24,6 @@ export const env = createEnv({ .transform((value) => parseInt(value)), REDIS_USERNAME: z.string().optional(), REDIS_PASSWORD: z.string().optional(), - REDIS_URL: z.string().optional(), REDIS_USE_TLS: z .enum(["true", "false"]) .optional() @@ -81,7 +80,6 @@ export const env = createEnv({ REDIS_USERNAME: process.env.REDIS_USERNAME, REDIS_PASSWORD: process.env.REDIS_PASSWORD, REDIS_TLS: process.env.REDIS_TLS, - REDIS_URL: process.env.REDIS_URL, REDIS_USE_TLS: process.env.REDIS_USE_TLS, NEXT_PUBLIC_IS_DEMO: process.env.NEXT_PUBLIC_IS_DEMO, NEXT_PUBLIC_DEMO_EMAIL: process.env.NEXT_PUBLIC_DEMO_EMAIL, diff --git a/src/lib/redis.ts b/src/lib/redis.ts index 4dcb3627..f97e8073 100644 --- a/src/lib/redis.ts +++ b/src/lib/redis.ts @@ -29,6 +29,7 @@ const options: RedisOptions = { numberOfKeys: 1, }, }, + tls: process.env.REDIS_USE_TLS === "true" ? {} : undefined, } export const redis = new Redis(options)