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-09-28 22:27:01 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-28 22:27:01 +0200
commitdc01de5f6d40c75c19050ad60fa679838bd653f2 (patch)
tree7ed506db7ff5053ba5dcdd0802ceb5242b25b685 /bundle/src/Server.ts
parentMerge branch 'master' of https://github.com/fosscord/fosscord-server (diff)
parent:bug: fix channel permission overwrites (diff)
downloadserver-dc01de5f6d40c75c19050ad60fa679838bd653f2.tar.xz
Merge branch 'master' of https://github.com/fosscord/fosscord-server
Diffstat (limited to '')
-rw-r--r--bundle/src/Server.ts16
1 files changed, 12 insertions, 4 deletions
diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts

index 56c82cd1..62764e8e 100644 --- a/bundle/src/Server.ts +++ b/bundle/src/Server.ts
@@ -24,16 +24,24 @@ const gateway = new GatewayServer({ server, port, production }); async function main() { await initDatabase(); await Config.init(); + // only set endpointPublic, if not already set await Config.set({ cdn: { endpointClient: "${location.host}", - endpoint: `http://localhost:${port}`, + endpointPrivate: `http://localhost:${port}`, + ...(!Config.get().cdn.endpointPublic && { + endpointPublic: `http://localhost:${port}`, + }), }, gateway: { - endpointClient: '${location.protocol === "https:" ? "wss://" : "ws://"}${location.host}', - endpoint: `ws://localhost:${port}`, + endpointClient: + '${location.protocol === "https:" ? "wss://" : "ws://"}${location.host}', + endpointPrivate: `ws://localhost:${port}`, + ...(!Config.get().gateway.endpointPublic && { + endpointPublic: `http://localhost:${port}`, + }), }, - }); + } as any); await Promise.all([api.start(), cdn.start(), gateway.start()]); console.log(`[Server] listening on port ${port}`);