From 5acd0ad669df25f18e309a51db33428a58f38d98 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 16 Jul 2021 16:15:48 +0200 Subject: :bug: fix server options --- src/Server.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Server.ts b/src/Server.ts index a88214ef..a0a2926e 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -10,9 +10,12 @@ export class Server { public ws: WebSocketServer; public port: number; public server: http.Server; + public production: boolean; - constructor({ port, server }: { port: number; server?: http.Server }) { + constructor({ port, server, production }: { port: number; server?: http.Server; production?: boolean }) { this.port = port; + this.production = production || false; + if (server) this.server = server; else this.server = http.createServer({}); @@ -34,8 +37,10 @@ export class Server { await this.setupSchema(); await Config.init(); console.log("[DB] connected"); - if (!this.server.listening) this.server.listen(this.port); - console.log(`[Gateway] online on 0.0.0.0:${this.port}`); + if (!this.server.listening) { + this.server.listen(this.port); + console.log(`[Gateway] online on 0.0.0.0:${this.port}`); + } } async stop() { -- cgit 1.5.1