65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import type { ServerInit } from '@sveltejs/kit';
|
|
import { handles } from './lib/server/handles/handle';
|
|
import { DatabaseBrokerManager } from '$lib/server/broker-utils/SQLite/Database';
|
|
import { UserApp } from '$lib/server/classes/users';
|
|
import { UserDBBroker } from '$lib/server/broker-utils/SQLite/Users';
|
|
import { SessionApp } from '$lib/server/classes/sessions';
|
|
import { SessionDBBroker } from '$lib/server/broker-utils/SQLite/Sessions';
|
|
import { AppData } from '$lib/server/classes/appdata';
|
|
import { logger } from '$lib/server/utils/logger';
|
|
import { JoseApp } from '$lib/server/utils/jtw-utils';
|
|
import { EndpointManagerApp } from '$lib/server/classes/endpoints/endpoint-manager';
|
|
import { SSLTerminationEndpointApp } from '$lib/server/classes/endpoints/ssl-termination-endpoint';
|
|
import { SSLTerminationFSBroker } from '$lib/server/broker-utils/FileSystem/SSLTerminations';
|
|
import { ManualEndpointApp } from '$lib/server/classes/endpoints/manual-endpoint';
|
|
import { ManualFSBroker } from '$lib/server/broker-utils/FileSystem/Manual';
|
|
|
|
export const init: ServerInit = async () => {
|
|
|
|
logger.debug("Starting app", "App Init")
|
|
|
|
if (!DatabaseBrokerManager.ready) {
|
|
DatabaseBrokerManager.init()
|
|
}
|
|
|
|
if (!UserApp.ready) {
|
|
UserApp.init(
|
|
new UserDBBroker()
|
|
)
|
|
}
|
|
|
|
if (!SessionApp.ready) {
|
|
SessionApp.init(
|
|
new SessionDBBroker()
|
|
)
|
|
}
|
|
|
|
if (!JoseApp.ready) {
|
|
// This is async
|
|
await JoseApp.init()
|
|
}
|
|
|
|
if(!EndpointManagerApp.ready) {
|
|
// This is async
|
|
await EndpointManagerApp.init()
|
|
}
|
|
|
|
if (!SSLTerminationEndpointApp.ready) {
|
|
SSLTerminationEndpointApp.init(
|
|
new SSLTerminationFSBroker()
|
|
)
|
|
}
|
|
|
|
if (!ManualEndpointApp.ready) {
|
|
ManualEndpointApp.init(
|
|
new ManualFSBroker()
|
|
)
|
|
}
|
|
|
|
|
|
|
|
logger.debug("Init run successfully", "App Init")
|
|
|
|
};
|
|
|
|
export const handle = handles |