mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-12 21:30:43 -05:00
Fixed dep injection issue causing server to not start - http server isn't capable of injecting DatabaseService
Made `PostDbLoadProcess` error out if db validation fails
This commit is contained in:
parent
db88c00b4d
commit
320835f122
@ -10,7 +10,6 @@ import { WebSocketServer } from "@spt/servers/WebSocketServer";
|
|||||||
import { IHttpListener } from "@spt/servers/http/IHttpListener";
|
import { IHttpListener } from "@spt/servers/http/IHttpListener";
|
||||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
import { inject, injectAll, injectable } from "tsyringe";
|
import { inject, injectAll, injectable } from "tsyringe";
|
||||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class HttpServer {
|
export class HttpServer {
|
||||||
@ -19,7 +18,6 @@ export class HttpServer {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject("PrimaryLogger") protected logger: ILogger,
|
@inject("PrimaryLogger") protected logger: ILogger,
|
||||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
|
||||||
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
|
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
|
||||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||||
@injectAll("HttpListener") protected httpListeners: IHttpListener[],
|
@injectAll("HttpListener") protected httpListeners: IHttpListener[],
|
||||||
@ -36,12 +34,6 @@ export class HttpServer {
|
|||||||
public load(): void {
|
public load(): void {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
|
|
||||||
// If the database couldn't be validated, don't start the server
|
|
||||||
if (!this.databaseService.isDatabaseValid())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create server */
|
/* create server */
|
||||||
const httpServer: Server = http.createServer();
|
const httpServer: Server = http.createServer();
|
||||||
|
|
||||||
|
@ -61,9 +61,8 @@ export class PostDbLoadService {
|
|||||||
// Kill the startup if not.
|
// Kill the startup if not.
|
||||||
// TODO: We can probably remove this in a couple versions
|
// TODO: We can probably remove this in a couple versions
|
||||||
this.databaseService.validateDatabase();
|
this.databaseService.validateDatabase();
|
||||||
if (!this.databaseService.isDatabaseValid())
|
if (!this.databaseService.isDatabaseValid()) {
|
||||||
{
|
throw new Error("Server start failure");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addCustomLooseLootPositions();
|
this.addCustomLooseLootPositions();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user