优化开发时环境配置

This commit is contained in:
2025-10-21 13:42:39 +08:00
parent 5617502713
commit 80310f710c
4 changed files with 15 additions and 6 deletions

View File

@@ -3,8 +3,9 @@ import { createClient, type RedisClientType } from 'redis'
const globalForRedis = globalThis as { redis?: RedisClientType }
const { REDIS_HOST, REDIS_PORT } = process.env
if (!globalForRedis.redis) {
globalForRedis.redis = createClient({ url: process.env.REDIS_URL })
globalForRedis.redis = createClient({ url: `redis://${REDIS_HOST}:${REDIS_PORT}` })
}
const redis = globalForRedis.redis