From fa7be5f11b25b084b637c052e22a0eb1dcebf5a4 Mon Sep 17 00:00:00 2001 From: luorijun Date: Tue, 21 Oct 2025 19:13:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20redis=20url=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/redis.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/redis.ts b/src/lib/redis.ts index 0014780..4efe21c 100644 --- a/src/lib/redis.ts +++ b/src/lib/redis.ts @@ -5,7 +5,7 @@ const globalForRedis = globalThis as { redis?: RedisClientType } const { REDIS_HOST, REDIS_PORT, REDIS_USERNAME, REDIS_PASSWORD } = process.env if (!globalForRedis.redis) { - const url = REDIS_USERNAME && REDIS_PASSWORD + const url = (REDIS_USERNAME || REDIS_PASSWORD) ? `redis://${REDIS_USERNAME}:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}` : `redis://${REDIS_HOST}:${REDIS_PORT}` console.log('test url', url)