summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-10 22:20:05 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-10 22:20:05 +1000
commit762bdd9bd51fb8d6133e0a73c2558b23774b7e7d (patch)
tree6580b3a1a48b3b2c7fc1b5c58a73124ad1887553
parentRelax some of the limits (diff)
downloadserver-762bdd9bd51fb8d6133e0a73c2558b23774b7e7d.tar.xz
Start listening after database and config has been loaded
-rw-r--r--bundle/src/Server.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts
index 71a60d49..74a36114 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,6 @@ 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 +90,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)}`)}`);
 }