@zdavison/matador 2.0.2 → 2.0.3

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.
@@ -62,6 +62,18 @@ interface ActiveConsumer {
62
62
  active: boolean;
63
63
  }
64
64
 
65
+ /**
66
+ * Redacts credentials from an AMQP URL.
67
+ * Replaces username and password with '****' regardless of their length.
68
+ *
69
+ * @example
70
+ * redactAmqpUrl('amqp://user:pass@host:5672') // 'amqp://****:****@host:5672'
71
+ */
72
+ export function redactAmqpUrl(url: string): string {
73
+ const regex = /^(amqps?:\/\/)[^:]+:[^@]+@/;
74
+ return url.replace(regex, '$1****:****@');
75
+ }
76
+
65
77
  /**
66
78
  * RabbitMQ transport implementation using amqplib.
67
79
  */
@@ -430,6 +442,9 @@ export class RabbitMQTransport implements Transport {
430
442
  }
431
443
 
432
444
  private async doConnect(): Promise<void> {
445
+ this.logger.info(
446
+ `[Matador] ⏳ Connecting to RabbitMQ at '${redactAmqpUrl(this.config.url)}'.`,
447
+ );
433
448
  const connection = await amqplib.connect(this.config.url);
434
449
  this.connection = connection;
435
450