From 4e1f49755e990650cc44d2dca8adf66edf8437f8 Mon Sep 17 00:00:00 2001 From: Giuseppe Raffa <77052701+sesee3@users.noreply.github.com> Date: Tue, 14 Apr 2026 10:12:26 +0200 Subject: [PATCH] fix: refactor Redis configuration to use separate host, port, and password fields --- server/src/config.js | 4 +++- server/src/services/queue.js | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/server/src/config.js b/server/src/config.js index a2d3ae0..3b9d7f8 100644 --- a/server/src/config.js +++ b/server/src/config.js @@ -8,7 +8,9 @@ const config = { jwtRefreshExpiry: '7d', // Redis - redisUrl: process.env.REDIS_URL || 'redis://localhost:6379/2', + redisHost: process.env.REDIS_HOST || 'localhost', + redisPort: process.env.REDIS_PORT || '6379', + redisPassword: process.env.REDIS_PASSWORD || undefined, // Gitea giteaUrl: process.env.GITEA_URL || 'http://gitea:3000', diff --git a/server/src/services/queue.js b/server/src/services/queue.js index 781648c..467e272 100644 --- a/server/src/services/queue.js +++ b/server/src/services/queue.js @@ -42,15 +42,19 @@ function notifyDeployListeners(deployId, message, stream) { * Initialize the build queue and worker */ export async function initQueue() { - // Parse Redis URL - const redisUrl = new URL(config.redisUrl); - console.log(`[QUEUE] Redis parsed - host: ${redisUrl.hostname}, port: ${redisUrl.port}, password: ${redisUrl.password ? '***' : '(none)'}, db: ${redisUrl.pathname}`); + + console.log(`[QUEUE] Redis: ${config.redisHost}:${config.redisPort} (DB 2)`); + + if (!config.redisPassword) { + console.error(`NO REDIS PASSWORD!`); + } + connection = new IORedis({ - host: redisUrl.hostname, - port: parseInt(redisUrl.port || '6379'), - db: parseInt(redisUrl.pathname?.replace('/', '') || '2'), - password: redisUrl.password || redisUrl.username || undefined, - maxRetriesPerRequest: null, // Required by BullMQ + host: config.redisHost, + port: parseInt(config.redisPort || '6379'), + db: parseInt('2'), + password: config.redisPassword || undefined, + maxRetriesPerRequest: null, enableReadyCheck: false, });