fix: refactor Redis configuration to use separate host, port, and password fields
This commit is contained in:
@@ -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',
|
||||||
|
|||||||
@@ -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,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user