From 194ef5478eb48d870c5d8844f1be6393dcd37ffa Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 13 Aug 2021 22:57:46 +0200 Subject: :construction: fix server bundle --- bundle/src/Server.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'bundle/src/Server.ts') diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts index 68966bf4..6951c1c4 100644 --- a/bundle/src/Server.ts +++ b/bundle/src/Server.ts @@ -9,9 +9,10 @@ import express from "express"; import { Config } from "../../util/dist"; const app = express(); -const server = http.createServer(app); +const server = http.createServer(); const port = Number(process.env.PORT) || 8080; const production = true; +server.on("request", app); // @ts-ignore const api = new APIServer({ server, port, production, app }); @@ -22,8 +23,14 @@ const gateway = new GatewayServer({ server, port, production }); async function main() { await Config.set({ - cdn: { endpointClientKeepDefault: true, endpoint: `http://localhost:${port}` }, - gateway: { endpointClientKeepDefault: true, endpoint: `ws://localhost:${port}` }, + cdn: { + endpointClient: "${location.host}", + endpoint: `http://localhost:${port}`, + }, + gateway: { + endpointClient: '${location.protocol === "https:" ? "wss://" : "ws://"}${location.host}', + endpoint: `ws://localhost:${port}`, + }, }); await api.start(); -- cgit 1.5.1