mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
18 lines
572 B
TypeScript
18 lines
572 B
TypeScript
import { createClient } from 'redis'
|
|
import { env } from './env'
|
|
|
|
export const redisClient = createClient({
|
|
url: env.redis.url,
|
|
socket: {
|
|
tls: env.redis.url?.startsWith('rediss://'), // rediss:// is the protocol for TLS
|
|
cert: env.redis.cert?.replace(/\\n/g, '\n'), // replace \n with new line
|
|
rejectUnauthorized: false, // for self-signed certs
|
|
connectTimeout: 10000, // 10 seconds
|
|
reconnectStrategy(retries: number): number | Error {
|
|
if (retries > 10) {
|
|
return new Error('Retries exhausted')
|
|
}
|
|
return 1000
|
|
},
|
|
},
|
|
})
|