From 23bebf94d475d6686afd5dc0039d34cd97574144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Thu, 15 Jun 2023 16:29:29 +0200 Subject: [PATCH] Add keyPrefix to redis --- api/source/rate-limiter.ts | 3 ++- api/source/redis-cache.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/source/rate-limiter.ts b/api/source/rate-limiter.ts index 1aa4ea7a0..389dce51b 100644 --- a/api/source/rate-limiter.ts +++ b/api/source/rate-limiter.ts @@ -13,8 +13,9 @@ const rateLimiter = ? new RateLimiterRedis({ storeClient: new Redis(process.env.SCALINGO_REDIS_URL, { enableOfflineQueue: false, + keyPrefix: 'rate-limiter', }), - keyPrefix: 'middleware', + keyPrefix: 'rate-limiter', points: 5, // 5 requests for ctx.ip duration: 1, // per 1 second }) diff --git a/api/source/redis-cache.ts b/api/source/redis-cache.ts index 474e2906b..adb30b113 100644 --- a/api/source/redis-cache.ts +++ b/api/source/redis-cache.ts @@ -13,6 +13,7 @@ const redis = process.env.NODE_ENV === 'production' && process.env.SCALINGO_REDIS_URL ? new Redis(process.env.SCALINGO_REDIS_URL, { enableOfflineQueue: false, + keyPrefix: 'cache', }) : new RedisMock()