mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
🐛 fix server options
This commit is contained in:
parent
1049f57454
commit
5acd0ad669
@ -17,7 +17,7 @@
|
|||||||
"ajv": "^8.5.0",
|
"ajv": "^8.5.0",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"lambert-server": "^1.1.7",
|
"lambert-server": "^1.2.7",
|
||||||
"missing-native-js-functions": "^1.2.3",
|
"missing-native-js-functions": "^1.2.3",
|
||||||
"mongoose-autopopulate": "^0.12.3",
|
"mongoose-autopopulate": "^0.12.3",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
|
@ -10,9 +10,12 @@ export class Server {
|
|||||||
public ws: WebSocketServer;
|
public ws: WebSocketServer;
|
||||||
public port: number;
|
public port: number;
|
||||||
public server: http.Server;
|
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.port = port;
|
||||||
|
this.production = production || false;
|
||||||
|
|
||||||
if (server) this.server = server;
|
if (server) this.server = server;
|
||||||
else this.server = http.createServer({});
|
else this.server = http.createServer({});
|
||||||
|
|
||||||
@ -34,8 +37,10 @@ export class Server {
|
|||||||
await this.setupSchema();
|
await this.setupSchema();
|
||||||
await Config.init();
|
await Config.init();
|
||||||
console.log("[DB] connected");
|
console.log("[DB] connected");
|
||||||
if (!this.server.listening) this.server.listen(this.port);
|
if (!this.server.listening) {
|
||||||
console.log(`[Gateway] online on 0.0.0.0:${this.port}`);
|
this.server.listen(this.port);
|
||||||
|
console.log(`[Gateway] online on 0.0.0.0:${this.port}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async stop() {
|
async stop() {
|
||||||
|
Loading…
Reference in New Issue
Block a user