mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
fix: kv use tls explicit (#610)
Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
This commit is contained in:
@@ -3,6 +3,10 @@ import { isBuildPhase } from "./next";
|
||||
|
||||
export type RedisClient = Pick<Redis, "get" | "setex" | "del">;
|
||||
|
||||
const KV_USE_TLS = process.env.KV_USE_TLS
|
||||
? process.env.KV_USE_TLS === "true"
|
||||
: undefined;
|
||||
|
||||
const getRedisClient = (): RedisClient => {
|
||||
const redisUrl = process.env.KV_URL;
|
||||
if (!redisUrl) {
|
||||
@@ -11,6 +15,11 @@ const getRedisClient = (): RedisClient => {
|
||||
const redis = new Redis(redisUrl, {
|
||||
maxRetriesPerRequest: 3,
|
||||
lazyConnect: true,
|
||||
...(KV_USE_TLS === true
|
||||
? {
|
||||
tls: {},
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
|
||||
redis.on("error", (error) => {
|
||||
|
||||
Reference in New Issue
Block a user