Add DragonflyDB integration for JWT revocation and implement rate limiting for authentication routes
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m14s

This commit is contained in:
2026-02-28 13:37:27 +01:00
parent ed97587248
commit 3556aaede7
8 changed files with 251 additions and 5 deletions

25
server/config/redis.js Normal file
View File

@@ -0,0 +1,25 @@
import Redis from 'ioredis';
const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379';
const redis = new Redis(REDIS_URL, {
enableOfflineQueue: false,
maxRetriesPerRequest: 1,
retryStrategy: (times) => {
if (times > 3) return null; // stop retrying after 3 attempts
return Math.min(times * 200, 1000);
},
});
redis.on('error', (err) => {
// Suppress ECONNREFUSED noise after initial failure — only warn
if (err.code !== 'ECONNREFUSED') {
console.warn('⚠️ DragonflyDB error:', err.message);
}
});
redis.on('connect', () => {
console.log('🐉 DragonflyDB connected');
});
export default redis;