mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
OneUptime Copilot: Improve Comments on /App/Index.ts
This commit is contained in:
68
App/Index.ts
68
App/Index.ts
@@ -1,27 +1,28 @@
|
||||
import APIReferenceRoutes from "./FeatureSet/ApiReference/Index";
|
||||
import BaseAPIRoutes from "./FeatureSet/BaseAPI/Index";
|
||||
import DocsRoutes from "./FeatureSet/Docs/Index";
|
||||
import HomeRoutes from "./FeatureSet/Home/Index";
|
||||
import APIReferenceRoutes from ./FeatureSet/ApiReference/Index;
|
||||
import BaseAPIRoutes from ./FeatureSet/BaseAPI/Index;
|
||||
import DocsRoutes from ./FeatureSet/Docs/Index;
|
||||
import HomeRoutes from ./FeatureSet/Home/Index;
|
||||
// import FeatureSets.
|
||||
import IdentityRoutes from "./FeatureSet/Identity/Index";
|
||||
import NotificationRoutes from "./FeatureSet/Notification/Index";
|
||||
import Workers from "./FeatureSet/Workers/Index";
|
||||
import Workflow from "./FeatureSet/Workflow/Index";
|
||||
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
|
||||
import { ClickhouseAppInstance } from "CommonServer/Infrastructure/ClickhouseDatabase";
|
||||
import { PostgresAppInstance } from "CommonServer/Infrastructure/PostgresDatabase";
|
||||
import Redis from "CommonServer/Infrastructure/Redis";
|
||||
import InfrastructureStatus from "CommonServer/Infrastructure/Status";
|
||||
import logger from "CommonServer/Utils/Logger";
|
||||
import Realtime from "CommonServer/Utils/Realtime";
|
||||
import App from "CommonServer/Utils/StartServer";
|
||||
import "CommonServer/Utils/Telemetry";
|
||||
import "ejs";
|
||||
import IdentityRoutes from ./FeatureSet/Identity/Index;
|
||||
import NotificationRoutes from ./FeatureSet/Notification/Index;
|
||||
import Workers from ./FeatureSet/Workers/Index;
|
||||
import Workflow from ./FeatureSet/Workflow/Index;
|
||||
import { PromiseVoidFunction } from Common/Types/FunctionTypes;
|
||||
import { ClickhouseAppInstance } from CommonServer/Infrastructure/ClickhouseDatabase;
|
||||
import { PostgresAppInstance } from CommonServer/Infrastructure/PostgresDatabase;
|
||||
import Redis from CommonServer/Infrastructure/Redis;
|
||||
import InfrastructureStatus from CommonServer/Infrastructure/Status;
|
||||
import logger from CommonServer/Utils/Logger;
|
||||
import Realtime from CommonServer/Utils/Realtime;
|
||||
import App from CommonServer/Utils/StartServer;
|
||||
import CommonServer/Utils/Telemetry;
|
||||
import ejs;
|
||||
|
||||
process.env["SERVICE_NAME"] = "app";
|
||||
process.env[SERVICE_NAME] = app;
|
||||
|
||||
const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
try {
|
||||
// Check the status of the infrastructure components
|
||||
const statusCheck: PromiseVoidFunction = async (): Promise<void> => {
|
||||
return await InfrastructureStatus.checkStatus({
|
||||
checkClickhouseStatus: true,
|
||||
@@ -30,30 +31,28 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
});
|
||||
};
|
||||
|
||||
// init the app
|
||||
// Initialize the app
|
||||
await App.init({
|
||||
appName: process.env["SERVICE_NAME"] || "app",
|
||||
appName: process.env[SERVICE_NAME] || app,
|
||||
statusOptions: {
|
||||
liveCheck: statusCheck,
|
||||
readyCheck: statusCheck,
|
||||
},
|
||||
});
|
||||
|
||||
// connect to the database.
|
||||
await PostgresAppInstance.connect(
|
||||
PostgresAppInstance.getDatasourceOptions(),
|
||||
);
|
||||
// Connect to the database
|
||||
await PostgresAppInstance.connect(PostgresAppInstance.getDatasourceOptions());
|
||||
|
||||
// connect redis
|
||||
// Connect to Redis
|
||||
await Redis.connect();
|
||||
|
||||
await ClickhouseAppInstance.connect(
|
||||
ClickhouseAppInstance.getDatasourceOptions(),
|
||||
);
|
||||
// Connect to Clickhouse
|
||||
await ClickhouseAppInstance.connect(ClickhouseAppInstance.getDatasourceOptions());
|
||||
|
||||
// Initialize Realtime
|
||||
await Realtime.init();
|
||||
|
||||
// init featuresets
|
||||
// Initialize feature sets
|
||||
await IdentityRoutes.init();
|
||||
await NotificationRoutes.init();
|
||||
await DocsRoutes.init();
|
||||
@@ -62,13 +61,13 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
await Workers.init();
|
||||
await Workflow.init();
|
||||
|
||||
// home should be in the end because it has the catch all route.
|
||||
// Initialize home routes (last because it has a catch-all route)
|
||||
await HomeRoutes.init();
|
||||
|
||||
// add default routes
|
||||
// Add default routes
|
||||
await App.addDefaultRoutes();
|
||||
} catch (err) {
|
||||
logger.error("App Init Failed:");
|
||||
logger.error(App Init Failed:);
|
||||
logger.error(err);
|
||||
throw err;
|
||||
}
|
||||
@@ -76,6 +75,7 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
logger.error("Exiting node process");
|
||||
logger.error(Exiting node process);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user