|
1 |
| -import { inDevelopment, inProduction } from '@n8n/backend-common'; |
| 1 | +import { inDevelopment, inProduction, LicenseState } from '@n8n/backend-common'; |
2 | 2 | import { SecurityConfig } from '@n8n/config';
|
3 | 3 | import { Container, Service } from '@n8n/di';
|
4 | 4 | import cookieParser from 'cookie-parser';
|
@@ -76,6 +76,7 @@ export class Server extends AbstractServer {
|
76 | 76 | private readonly postHogClient: PostHogClient,
|
77 | 77 | private readonly eventService: EventService,
|
78 | 78 | private readonly instanceSettings: InstanceSettings,
|
| 79 | + private readonly licenseState: LicenseState, |
79 | 80 | ) {
|
80 | 81 | super();
|
81 | 82 |
|
@@ -152,15 +153,23 @@ export class Server extends AbstractServer {
|
152 | 153 | // ----------------------------------------
|
153 | 154 | // Source Control
|
154 | 155 | // ----------------------------------------
|
| 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 | + |
155 | 169 | 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'); |
161 | 170 | await import('@/environments.ee/variables/variables.controller.ee');
|
162 | 171 | } 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}`); |
164 | 173 | }
|
165 | 174 | }
|
166 | 175 |
|
|
0 commit comments