🚧 back: WIP Initial diagnostic endpoint (#762)

This commit is contained in:
Eric Doughty-Papassideris
2024-12-08 22:49:10 +01:00
parent 4c05cf9dee
commit 98723a5f86
22 changed files with 596 additions and 32 deletions
@@ -32,8 +32,8 @@ export class AVServiceImpl implements TdriveServiceProvider, Initializable {
},
});
}
} catch (error) {
logger.error({ error: `${error}` }, "Error while initializing Antivirus Service");
} catch (err) {
logger.error({ err }, "Error while initializing Antivirus Service");
throw AVException.initializationFailed("Failed to initialize Antivirus service");
}
return this;
@@ -15,7 +15,7 @@ import TrackerAPI from "../core/platform/services/tracker/provider";
import WebServerAPI from "../core/platform/services/webserver/provider";
import assert from "assert";
import { logger } from "../core/platform/framework";
import { logger, TdriveServiceState } from "../core/platform/framework";
import { ApplicationServiceImpl } from "./applications/services/applications";
import { CompanyApplicationServiceImpl } from "./applications/services/company-applications";
import { ApplicationHooksService } from "./applications/services/hooks";
@@ -78,6 +78,7 @@ class GlobalResolver {
public services: TdriveServices;
public platformServices: PlatformServices;
public database: DatabaseServiceAPI;
private platform?: TdrivePlatform;
public fastify: FastifyInstance<Server, IncomingMessage, ServerResponse>;
@@ -87,6 +88,7 @@ class GlobalResolver {
if (this.alreadyInitialized) {
return;
}
this.platform = platform;
this.database = platform.getProvider<DatabaseServiceAPI>("database");
this.platformServices = {
@@ -152,6 +154,11 @@ class GlobalResolver {
logger.info("Global resolver finished initializing services");
this.alreadyInitialized = true;
}
/** `true` if all components are in the started state. This means we should respond to http at least (for kubernetes Startup probe). */
isPlatformStarted(): boolean {
return this.alreadyInitialized && this.platform?.state.getValue() == TdriveServiceState.Started;
}
}
export default new GlobalResolver();