mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: streamline database connection logic in app initialization
This commit is contained in:
20
App/Index.ts
20
App/Index.ts
@@ -79,6 +79,17 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
});
|
||||
};
|
||||
|
||||
// Connect to Postgres database
|
||||
await PostgresAppInstance.connect();
|
||||
|
||||
// Connect to Redis
|
||||
await Redis.connect();
|
||||
|
||||
// Connect to Clickhouse database
|
||||
await ClickhouseAppInstance.connect(
|
||||
ClickhouseAppInstance.getDatasourceOptions(),
|
||||
);
|
||||
|
||||
// Initialize the app with service name and status checks
|
||||
await App.init({
|
||||
appName: APP_NAME,
|
||||
@@ -91,16 +102,7 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
},
|
||||
});
|
||||
|
||||
// Connect to Postgres database
|
||||
await PostgresAppInstance.connect();
|
||||
|
||||
// Connect to Redis
|
||||
await Redis.connect();
|
||||
|
||||
// Connect to Clickhouse database
|
||||
await ClickhouseAppInstance.connect(
|
||||
ClickhouseAppInstance.getDatasourceOptions(),
|
||||
);
|
||||
|
||||
// Initialize real-time functionalities
|
||||
await Realtime.init();
|
||||
|
||||
Reference in New Issue
Block a user