mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat(core): Handle disabled modules logic and db engine dependent default for insights (#14243)
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
committed by
GitHub
parent
00038be81a
commit
b568caa209
@@ -23,6 +23,7 @@ import {
|
||||
} from '@/constants';
|
||||
import * as CrashJournal from '@/crash-journal';
|
||||
import * as Db from '@/db';
|
||||
import { ModuleRegistry } from '@/decorators/module';
|
||||
import { getDataDeduplicationService } from '@/deduplication';
|
||||
import { DeprecationService } from '@/deprecation/deprecation.service';
|
||||
import { TestRunnerService } from '@/evaluation.ee/test-runner/test-runner.service.ee';
|
||||
@@ -33,6 +34,7 @@ import { ExternalHooks } from '@/external-hooks';
|
||||
import { ExternalSecretsManager } from '@/external-secrets.ee/external-secrets-manager.ee';
|
||||
import { License } from '@/license';
|
||||
import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials';
|
||||
import type { ModulePreInit } from '@/modules/modules.config';
|
||||
import { ModulesConfig } from '@/modules/modules.config';
|
||||
import { NodeTypes } from '@/node-types';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
@@ -71,9 +73,29 @@ export abstract class BaseCommand extends Command {
|
||||
|
||||
protected async loadModules() {
|
||||
for (const moduleName of this.modulesConfig.modules) {
|
||||
await import(`../modules/${moduleName}/${moduleName}.module`);
|
||||
this.logger.debug(`Loaded module "${moduleName}"`);
|
||||
let preInitModule: ModulePreInit | undefined;
|
||||
try {
|
||||
preInitModule = (await import(
|
||||
`../modules/${moduleName}/${moduleName}.pre-init`
|
||||
)) as ModulePreInit;
|
||||
} catch {}
|
||||
|
||||
if (
|
||||
!preInitModule ||
|
||||
preInitModule.shouldLoadModule?.({
|
||||
database: this.globalConfig.database,
|
||||
instance: this.instanceSettings,
|
||||
})
|
||||
) {
|
||||
// register module in the registry for the dependency injection
|
||||
await import(`../modules/${moduleName}/${moduleName}.module`);
|
||||
|
||||
this.modulesConfig.addLoadedModule(moduleName);
|
||||
this.logger.debug(`Loaded module "${moduleName}"`);
|
||||
}
|
||||
}
|
||||
|
||||
Container.get(ModuleRegistry).initializeModules();
|
||||
}
|
||||
|
||||
async init(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user