summary refs log tree commit diff
path: root/src/gateway/Server.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/gateway/Server.ts (renamed from gateway/src/Server.ts)21
1 files changed, 6 insertions, 15 deletions
diff --git a/gateway/src/Server.ts b/src/gateway/Server.ts

index 7e1489be..97da3fa0 100644 --- a/gateway/src/Server.ts +++ b/src/gateway/Server.ts
@@ -1,10 +1,9 @@ -import "missing-native-js-functions"; +import { closeDatabase, Config, getOrInitialiseDatabase, initEvent } from "@fosscord/util"; import dotenv from "dotenv"; -dotenv.config(); -import { closeDatabase, Config, initDatabase, initEvent } from "@fosscord/util"; +import http from "http"; import ws from "ws"; import { Connection } from "./events/Connection"; -import http from "http"; +dotenv.config(); export class Server { public ws: ws.Server; @@ -12,15 +11,7 @@ export class Server { public server: http.Server; public production: boolean; - constructor({ - port, - server, - production, - }: { - port: number; - server?: http.Server; - production?: boolean; - }) { + constructor({ port, server, production }: { port: number; server?: http.Server; production?: boolean }) { this.port = port; this.production = production || false; @@ -40,14 +31,14 @@ export class Server { this.ws = new ws.Server({ maxPayload: 4096, - noServer: true, + noServer: true }); this.ws.on("connection", Connection); this.ws.on("error", console.error); } async start(): Promise<void> { - await initDatabase(); + await getOrInitialiseDatabase(); await Config.init(); await initEvent(); if (!this.server.listening) {