fix: refactor Redis configuration to use separate host, port, and password fields

This commit is contained in:
Giuseppe Raffa
2026-04-14 10:12:26 +02:00
parent a24accb04b
commit 4e1f49755e
2 changed files with 15 additions and 9 deletions

View File

@@ -8,7 +8,9 @@ const config = {
jwtRefreshExpiry: '7d', jwtRefreshExpiry: '7d',
// Redis // 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 // Gitea
giteaUrl: process.env.GITEA_URL || 'http://gitea:3000', giteaUrl: process.env.GITEA_URL || 'http://gitea:3000',

View File

@@ -42,15 +42,19 @@ function notifyDeployListeners(deployId, message, stream) {
* Initialize the build queue and worker * Initialize the build queue and worker
*/ */
export async function initQueue() { export async function initQueue() {
// Parse Redis URL
const redisUrl = new URL(config.redisUrl); console.log(`[QUEUE] Redis: ${config.redisHost}:${config.redisPort} (DB 2)`);
console.log(`[QUEUE] Redis parsed - host: ${redisUrl.hostname}, port: ${redisUrl.port}, password: ${redisUrl.password ? '***' : '(none)'}, db: ${redisUrl.pathname}`);
if (!config.redisPassword) {
console.error(`NO REDIS PASSWORD!`);
}
connection = new IORedis({ connection = new IORedis({
host: redisUrl.hostname, host: config.redisHost,
port: parseInt(redisUrl.port || '6379'), port: parseInt(config.redisPort || '6379'),
db: parseInt(redisUrl.pathname?.replace('/', '') || '2'), db: parseInt('2'),
password: redisUrl.password || redisUrl.username || undefined, password: config.redisPassword || undefined,
maxRetriesPerRequest: null, // Required by BullMQ maxRetriesPerRequest: null,
enableReadyCheck: false, enableReadyCheck: false,
}); });