diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-10 22:08:42 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-10 22:14:18 +1000 |
commit | d20a24748cb0d9fe8161384cc8185b5baa87b453 (patch) | |
tree | b7b603116361a461b7eefc475a39c95f4e2c4d5c | |
parent | Check if role icon was actually sent or if it's just an empty string (diff) | |
download | server-d20a24748cb0d9fe8161384cc8185b5baa87b453.tar.xz |
Change bundle start to only start listening once DB and config have been loaded
-rw-r--r-- | bundle/src/Server.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts index bc1d7cbc..651e8e64 100644 --- a/bundle/src/Server.ts +++ b/bundle/src/Server.ts @@ -33,7 +33,6 @@ process.on('SIGTERM', () => { //this is what has been added for the /stop API route async function main() { - server.listen(port); await initDatabase(); await Config.init(); // only set endpointPublic, if not already set @@ -84,7 +83,7 @@ async function main() { app.use(Sentry.Handlers.requestHandler()); app.use(Sentry.Handlers.tracingHandler()); } - await Promise.all([api.start(), cdn.start(), gateway.start()]); + if (Config.get().sentry.enabled) { app.use(Sentry.Handlers.errorHandler()); app.use(function onError(err: any, req: any, res: any, next: any) { @@ -92,6 +91,8 @@ async function main() { res.end(res.sentry + "\n"); }); } + + await Promise.all([api.start(), cdn.start(), gateway.start()]); console.log(`[Server] ${green(`listening on port ${bold(port)}`)}`); } |