force env

This commit is contained in:
SrGooglo 2023-11-28 18:59:33 +00:00
parent 3dda8ee9de
commit 84c84a42f8
6 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,3 @@
import path from "path" import path from "path"
global.FORCE_ENV = "prod"
require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper"))

View File

@ -67,7 +67,7 @@ export async function createWebsockets() {
if (remotes[key].useClassicAuth && remotes[key].noAuth !== true) { if (remotes[key].useClassicAuth && remotes[key].noAuth !== true) {
// try to auth // try to auth
instance.emit("authenticate", { instance.emit("auth", {
token: SessionModel.token, 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 } = {}) { export async function reconnectWebsockets({ force = false } = {}) {
const instances = globalThis.__comty_shared_state.wsInstances const instances = globalThis.__comty_shared_state.wsInstances

View File

@ -1,3 +1,4 @@
import path from "path" import path from "path"
global.FORCE_ENV = "prod"
require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper"))

View File

@ -1,3 +1,4 @@
import path from "path" import path from "path"
global.FORCE_ENV = "prod"
require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper"))

View File

@ -1,3 +1,4 @@
import path from "path" import path from "path"
global.FORCE_ENV = "prod"
require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper"))

View File

@ -1,3 +1,4 @@
import path from "path" import path from "path"
global.FORCE_ENV = "prod"
require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper")) require(path.resolve(process.cwd(), "../../shared/lib/api_wrapper"))