summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-10 22:08:42 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-10 22:14:18 +1000
commit3e47da130ce61effef3632cc446f38b29f8be5c0 (patch)
treecfd936d1f7f0f518513cecda947dad6244e0d639
parentCheck if role icon was actually sent or if it's just an empty string (diff)
downloadserver-3e47da130ce61effef3632cc446f38b29f8be5c0.tar.xz
Change bundle start to only start listening once DB and config have been loaded
-rw-r--r--bundle/src/Server.ts5
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)}`)}`);
 }