@astralibx/email-account-manager 10.0.0 → 10.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1375,6 +1375,18 @@ var UnsubscribeService = class {
1375
1375
  </html>`;
1376
1376
  }
1377
1377
  };
1378
+ function getRedisOptions(redis) {
1379
+ const opts = redis.options;
1380
+ const config = {
1381
+ host: opts.host || "localhost",
1382
+ port: opts.port || 6379,
1383
+ db: opts.db ?? 0
1384
+ };
1385
+ if (opts.username) config.username = opts.username;
1386
+ if (opts.password) config.password = opts.password;
1387
+ if (opts.tls) config.tls = opts.tls;
1388
+ return config;
1389
+ }
1378
1390
  var QueueService = class {
1379
1391
  constructor(redis, config, settings, logger) {
1380
1392
  this.redis = redis;
@@ -1392,20 +1404,20 @@ var QueueService = class {
1392
1404
  const approvalQueueName = this.config.options?.queues?.approvalQueueName || "email-approved";
1393
1405
  const globalSettings = await this.settings.get();
1394
1406
  const queueSettings = globalSettings.queues;
1395
- const redisConnection = this.redis;
1407
+ const connectionOpts = getRedisOptions(this.redis);
1396
1408
  this.sendQueue = new bullmq.Queue(sendQueueName, {
1397
- connection: redisConnection,
1409
+ connection: connectionOpts,
1398
1410
  prefix: keyPrefix
1399
1411
  });
1400
1412
  this.approvalQueue = new bullmq.Queue(approvalQueueName, {
1401
- connection: redisConnection,
1413
+ connection: connectionOpts,
1402
1414
  prefix: keyPrefix
1403
1415
  });
1404
1416
  this.sendWorker = new bullmq.Worker(
1405
1417
  sendQueueName,
1406
1418
  processors.sendProcessor,
1407
1419
  {
1408
- connection: redisConnection,
1420
+ connection: connectionOpts,
1409
1421
  prefix: keyPrefix,
1410
1422
  concurrency: queueSettings.sendConcurrency
1411
1423
  }
@@ -1414,7 +1426,7 @@ var QueueService = class {
1414
1426
  approvalQueueName,
1415
1427
  processors.approvalProcessor,
1416
1428
  {
1417
- connection: redisConnection,
1429
+ connection: connectionOpts,
1418
1430
  prefix: keyPrefix,
1419
1431
  concurrency: queueSettings.approvalConcurrency
1420
1432
  }