From 29f23364677aa3d59b367da28ebb86ee58784d14 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Tue, 28 Nov 2023 18:59:33 +0000 Subject: [PATCH] force env --- packages/chat_server/src/index.js | 2 +- packages/comty.js/src/index.js | 12 +++++++++++- packages/file_server/src/index.js | 1 + packages/marketplace_server/src/index.js | 1 + packages/music_server/src/index.js | 1 + packages/sync_server/src/index.js | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/chat_server/src/index.js b/packages/chat_server/src/index.js index 330a4a18..2c5a7eb1 100755 --- a/packages/chat_server/src/index.js +++ b/packages/chat_server/src/index.js @@ -1,3 +1,3 @@ import path from "path" - +global.FORCE_ENV = "prod" require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) \ No newline at end of file diff --git a/packages/comty.js/src/index.js b/packages/comty.js/src/index.js index 4f062265..9b64c944 100644 --- a/packages/comty.js/src/index.js +++ b/packages/comty.js/src/index.js @@ -67,7 +67,7 @@ export async function createWebsockets() { if (remotes[key].useClassicAuth && remotes[key].noAuth !== true) { // try to auth - instance.emit("authenticate", { + instance.emit("auth", { token: SessionModel.token, }) } @@ -95,6 +95,16 @@ export async function createWebsockets() { } } +export async function disconnectWebsockets() { + const instances = globalThis.__comty_shared_state.wsInstances + + for (let [key, instance] of Object.entries(instances)) { + if (instance.connected) { + instance.disconnect() + } + } +} + export async function reconnectWebsockets({ force = false } = {}) { const instances = globalThis.__comty_shared_state.wsInstances diff --git a/packages/file_server/src/index.js b/packages/file_server/src/index.js index 330a4a18..9a830edd 100644 --- a/packages/file_server/src/index.js +++ b/packages/file_server/src/index.js @@ -1,3 +1,4 @@ import path from "path" +global.FORCE_ENV = "prod" require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) \ No newline at end of file diff --git a/packages/marketplace_server/src/index.js b/packages/marketplace_server/src/index.js index 330a4a18..9a830edd 100644 --- a/packages/marketplace_server/src/index.js +++ b/packages/marketplace_server/src/index.js @@ -1,3 +1,4 @@ import path from "path" +global.FORCE_ENV = "prod" require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) \ No newline at end of file diff --git a/packages/music_server/src/index.js b/packages/music_server/src/index.js index 330a4a18..9a830edd 100755 --- a/packages/music_server/src/index.js +++ b/packages/music_server/src/index.js @@ -1,3 +1,4 @@ import path from "path" +global.FORCE_ENV = "prod" require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) \ No newline at end of file diff --git a/packages/sync_server/src/index.js b/packages/sync_server/src/index.js index 330a4a18..9a830edd 100644 --- a/packages/sync_server/src/index.js +++ b/packages/sync_server/src/index.js @@ -1,3 +1,4 @@ import path from "path" +global.FORCE_ENV = "prod" require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) \ No newline at end of file