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, });