@autofleet/rabbit 2.0.4 → 2.1.0

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.js CHANGED
@@ -109,8 +109,10 @@ class RabbitMq {
109
109
  return resolve(this.connection);
110
110
  }
111
111
  this.creatingConnection = true;
112
+ const username = process.env.RABBITMQ_USERNAME || 'guest';
113
+ const password = process.env.RABBITMQ_PASSWORD || 'guest';
112
114
  const host = process.env.RABBITMQ_SERVICE_HOST || '';
113
- const connection = yield amqp_connection_manager_1.connect([`amqp://${host}`]);
115
+ const connection = yield amqp_connection_manager_1.connect([`amqp://${username}:${password}@${host}`]);
114
116
  this.connection = connection;
115
117
  this.connection.on('disconnect', ({ err }) => {
116
118
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "2.0.4",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -137,8 +137,10 @@ class RabbitMq implements IAfRabbitMq {
137
137
  return resolve(this.connection);
138
138
  }
139
139
  this.creatingConnection = true;
140
+ const username: string = process.env.RABBITMQ_USERNAME || 'guest';
141
+ const password: string = process.env.RABBITMQ_PASSWORD || 'guest';
140
142
  const host: string = process.env.RABBITMQ_SERVICE_HOST || '';
141
- const connection: AmqpConnectionManager = await connect([`amqp://${host}`]);
143
+ const connection: AmqpConnectionManager = await connect([`amqp://${username}:${password}@${host}`]);
142
144
  this.connection = connection;
143
145
  this.connection.on('disconnect',
144
146
  ({ err }) => {