summary refs log tree commit diff
path: root/bundle/src/Server.ts
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 /bundle/src/Server.ts
parentMerge branch 'master' of https://github.com/fosscord/fosscord-api (diff)
downloadserver-1f167e11df2535819a9d595f5302438fa52625b5.tar.xz
:construction: fix server bundle
Diffstat (limited to 'bundle/src/Server.ts')
-rw-r--r--bundle/src/Server.ts13
1 files changed, 10 insertions, 3 deletions
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();