Skip to content

Commit d7e94eb

Browse files
authored
perf(core): Load source control only if licensed (#15908)
1 parent 62dfc81 commit d7e94eb

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

packages/cli/src/server.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { inDevelopment, inProduction } from '@n8n/backend-common';
1+
import { inDevelopment, inProduction, LicenseState } from '@n8n/backend-common';
22
import { SecurityConfig } from '@n8n/config';
33
import { Container, Service } from '@n8n/di';
44
import cookieParser from 'cookie-parser';
@@ -76,6 +76,7 @@ export class Server extends AbstractServer {
7676
private readonly postHogClient: PostHogClient,
7777
private readonly eventService: EventService,
7878
private readonly instanceSettings: InstanceSettings,
79+
private readonly licenseState: LicenseState,
7980
) {
8081
super();
8182

@@ -152,15 +153,23 @@ export class Server extends AbstractServer {
152153
// ----------------------------------------
153154
// Source Control
154155
// ----------------------------------------
156+
157+
if (this.licenseState.isSourceControlLicensed()) {
158+
try {
159+
const { SourceControlService } = await import(
160+
'@/environments.ee/source-control/source-control.service.ee'
161+
);
162+
await Container.get(SourceControlService).init();
163+
await import('@/environments.ee/source-control/source-control.controller.ee');
164+
} catch (error) {
165+
this.logger.warn(`Source control initialization failed: ${(error as Error).message}`);
166+
}
167+
}
168+
155169
try {
156-
const { SourceControlService } = await import(
157-
'@/environments.ee/source-control/source-control.service.ee'
158-
);
159-
await Container.get(SourceControlService).init();
160-
await import('@/environments.ee/source-control/source-control.controller.ee');
161170
await import('@/environments.ee/variables/variables.controller.ee');
162171
} catch (error) {
163-
this.logger.warn(`Source Control initialization failed: ${(error as Error).message}`);
172+
this.logger.warn(`Variables initialization failed: ${(error as Error).message}`);
164173
}
165174
}
166175

0 commit comments

Comments
 (0)