refactor(core): Use DI for LDAP code (no-changelog) (#8248)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Ricardo Espinoza
2024-01-15 09:01:48 -05:00
committed by GitHub
parent a6a5372b5f
commit 3c2a4000ae
11 changed files with 492 additions and 598 deletions

View File

@@ -70,7 +70,7 @@ import { EventBusControllerEE } from '@/eventbus/eventBus.controller.ee';
import { LicenseController } from '@/license/license.controller';
import { setupPushServer, setupPushHandler } from '@/push';
import { setupAuthMiddlewares } from './middlewares';
import { handleLdapInit, isLdapEnabled } from './Ldap/helpers';
import { isLdapEnabled } from './Ldap/helpers';
import { AbstractServer } from './AbstractServer';
import { PostHogClient } from './posthog';
import { eventBus } from './eventbus';
@@ -255,7 +255,9 @@ export class Server extends AbstractServer {
}
if (isLdapEnabled()) {
const { LdapController } = await require('@/controllers/ldap.controller');
const { LdapService } = await import('@/Ldap/ldap.service');
const { LdapController } = await require('@/Ldap/ldap.controller');
await Container.get(LdapService).init();
controllers.push(LdapController);
}
@@ -351,8 +353,6 @@ export class Server extends AbstractServer {
await Container.get(Queue).init();
}
await handleLdapInit();
await handleMfaDisable();
await this.registerControllers(ignoredEndpoints);