@ -39,6 +39,7 @@
|
||||
"escape-html": "1.0.3",
|
||||
"google-auth-library": "8.9.0",
|
||||
"ky": "1.2.4",
|
||||
"ioredis": "5.4.1",
|
||||
"minio": "7.1.3",
|
||||
"posthog-node": "3.1.1",
|
||||
"remark-parse": "11.0.0",
|
||||
|
16
packages/lib/redis.ts
Normal file
16
packages/lib/redis.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { env } from '@typebot.io/env'
|
||||
import Redis from 'ioredis'
|
||||
|
||||
declare const global: { redis: Redis | undefined }
|
||||
let redis: Redis | undefined
|
||||
|
||||
if (env.NODE_ENV === 'production' && !process.versions.bun && env.REDIS_URL) {
|
||||
redis = new Redis(env.REDIS_URL)
|
||||
} else if (env.REDIS_URL) {
|
||||
if (!global.redis) {
|
||||
global.redis = new Redis(env.REDIS_URL)
|
||||
}
|
||||
redis = global.redis
|
||||
}
|
||||
|
||||
export default redis
|
Reference in New Issue
Block a user