mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Port endpoints config (no-changelog) (#10268)
This commit is contained in:
@@ -4,7 +4,6 @@ import type { Application, Request, Response, RequestHandler } from 'express';
|
||||
import { rateLimit as expressRateLimit } from 'express-rate-limit';
|
||||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import config from '@/config';
|
||||
import { UnauthenticatedError } from '@/errors/response-errors/unauthenticated.error';
|
||||
import { inProduction, RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import type { BooleanLicenseFeature } from '@/Interfaces';
|
||||
@@ -12,7 +11,7 @@ import { License } from '@/License';
|
||||
import type { AuthenticatedRequest } from '@/requests';
|
||||
import { send } from '@/ResponseHelper'; // TODO: move `ResponseHelper.send` to this file
|
||||
import { userHasScope } from '@/permissions/checkAccess';
|
||||
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import type {
|
||||
AccessScope,
|
||||
Controller,
|
||||
@@ -52,6 +51,7 @@ export class ControllerRegistry {
|
||||
constructor(
|
||||
private readonly license: License,
|
||||
private readonly authService: AuthService,
|
||||
private readonly globalConfig: GlobalConfig,
|
||||
) {}
|
||||
|
||||
activate(app: Application) {
|
||||
@@ -64,7 +64,7 @@ export class ControllerRegistry {
|
||||
const metadata = registry.get(controllerClass)!;
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
const prefix = `/${config.getEnv('endpoints.rest')}/${metadata.basePath}`
|
||||
const prefix = `/${this.globalConfig.endpoints.rest}/${metadata.basePath}`
|
||||
.replace(/\/+/g, '/')
|
||||
.replace(/\/$/, '');
|
||||
app.use(prefix, router);
|
||||
|
||||
Reference in New Issue
Block a user