Allow running api, cdn, gateway separately

This commit is contained in:
Madeline
2022-10-31 13:17:21 +11:00
parent ed92e2fa65
commit 49ae07ff29
5 changed files with 19 additions and 14 deletions
+10 -11
View File
@@ -1,5 +1,5 @@
import amqp, { Connection, Channel } from "amqplib";
// import Config from "./Config";
import { Config } from "./Config";
export const RabbitMQ: {
connection: Connection | null;
@@ -9,15 +9,14 @@ export const RabbitMQ: {
connection: null,
channel: null,
init: async function () {
return;
// const host = Config.get().rabbitmq.host;
// if (!host) return;
// console.log(`[RabbitMQ] connect: ${host}`);
// this.connection = await amqp.connect(host, {
// timeout: 1000 * 60,
// });
// console.log(`[RabbitMQ] connected`);
// this.channel = await this.connection.createChannel();
// console.log(`[RabbitMQ] channel created`);
const host = Config.get().rabbitmq.host;
if (!host) return;
console.log(`[RabbitMQ] connect: ${host}`);
this.connection = await amqp.connect(host, {
timeout: 1000 * 60,
});
console.log(`[RabbitMQ] connected`);
this.channel = await this.connection.createChannel();
console.log(`[RabbitMQ] channel created`);
},
};