From 49ae07ff297b0cffbb667d627320092a1022230c Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Mon, 31 Oct 2022 13:16:29 +1100 Subject: Allow running api, cdn, gateway separately --- src/util/util/RabbitMQ.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/util') diff --git a/src/util/util/RabbitMQ.ts b/src/util/util/RabbitMQ.ts index 1bfb3f5c..f59f6fe3 100644 --- a/src/util/util/RabbitMQ.ts +++ b/src/util/util/RabbitMQ.ts @@ -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`); }, }; -- cgit 1.4.1