From 8ade507290bf86271674d93daa18c5387eb116d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pe=C3=AFo=20Thibault?= Date: Fri, 25 Oct 2024 19:06:06 +0200 Subject: [PATCH] fix(storage): use inner ioredis to ignore self-signed cert (#148) --- package.json | 1 + pnpm-lock.yaml | 3 +++ src/core/cache.ts | 8 +++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 22d68d1..01f9f1c 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "cheerio": "1.0.0-rc.12", "cron": "3.1.7", "discord.js": "14.15.3", + "ioredis": "5.4.1", "keyv": "4.5.4", "nanoid": "5.0.7", "open-graph-scraper": "6.5.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09fc5c1..6e3c3a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: discord.js: specifier: 14.15.3 version: 14.15.3 + ioredis: + specifier: 5.4.1 + version: 5.4.1 keyv: specifier: 4.5.4 version: 4.5.4 diff --git a/src/core/cache.ts b/src/core/cache.ts index f84ecad..829e423 100644 --- a/src/core/cache.ts +++ b/src/core/cache.ts @@ -1,5 +1,5 @@ -import '@keyv/redis'; - +import KeyvRedis from '@keyv/redis'; +import Redis from 'ioredis'; import Keyv from 'keyv'; import type { Frequency } from '../modules/recurringMessage/recurringMessage.helpers'; @@ -28,7 +28,9 @@ interface CacheEntries { } class CacheImpl implements Cache { - private readonly backend = new Keyv(env.redisUrl); + private readonly redis = new Redis(env.redisUrl, { tls: { rejectUnauthorized: false } }); + + private readonly backend = new Keyv({ store: new KeyvRedis(this.redis) }); public get(key: Key): Promise; public get(