summary refs log tree commit diff
path: root/util/src
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-13 22:57:46 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-13 22:57:46 +0200
commit1f167e11df2535819a9d595f5302438fa52625b5 (patch)
treeffe704051842826603cabd7051e376a2f12aeb15 /util/src
parentMerge branch 'master' of https://github.com/fosscord/fosscord-api (diff)
downloadserver-1f167e11df2535819a9d595f5302438fa52625b5.tar.xz
:construction: fix server bundle
Diffstat (limited to 'util/src')
-rw-r--r--util/src/util/Config.ts8
-rw-r--r--util/src/util/Event.ts7
2 files changed, 10 insertions, 5 deletions
diff --git a/util/src/util/Config.ts b/util/src/util/Config.ts
index a23d724d..09a42564 100644
--- a/util/src/util/Config.ts
+++ b/util/src/util/Config.ts
@@ -43,11 +43,11 @@ export interface KafkaBroker {
 
 export interface DefaultOptions {
 	gateway: {
-		endpointClientKeepDefault?: boolean;
+		endpointClient: string | null;
 		endpoint: string | null;
 	};
 	cdn: {
-		endpointClientKeepDefault?: boolean;
+		endpointClient: string | null;
 		endpoint: string | null;
 	};
 	general: {
@@ -150,11 +150,11 @@ export interface DefaultOptions {
 
 export const DefaultOptions: DefaultOptions = {
 	gateway: {
-		endpointClientKeepDefault: false,
+		endpointClient: null,
 		endpoint: null,
 	},
 	cdn: {
-		endpointClientKeepDefault: false,
+		endpointClient: null,
 		endpoint: null,
 	},
 	general: {
diff --git a/util/src/util/Event.ts b/util/src/util/Event.ts
index 13dd797a..c088e8b3 100644
--- a/util/src/util/Event.ts
+++ b/util/src/util/Event.ts
@@ -16,6 +16,7 @@ export async function emitEvent(payload: Omit<Event, "created_at">) {
 		const successful = RabbitMQ.channel?.publish(id, "", Buffer.from(`${data}`), { type: payload.event });
 		if (!successful) throw new Error("failed to send event");
 	} else {
+		console.log("emit event", id);
 		events.emit(id, payload);
 	}
 }
@@ -44,7 +45,11 @@ export async function listenEvent(event: string, callback: (event: EventOpts) =>
 		// @ts-ignore
 		return rabbitListen(opts?.channel || RabbitMQ.channel, event, callback, { acknowledge: opts?.acknowledge });
 	} else {
-		const cancel = () => events.removeListener(event, callback);
+		const cancel = () => {
+			console.log("cancel event", event);
+			events.removeListener(event, callback);
+		};
+		console.log("listen event", event);
 		events.addListener(event, (opts) => callback({ ...opts, cancel }));
 
 		return cancel;