diff --git a/src/lib/routes/index.ts b/src/lib/routes/index.ts index 91ba4e55f7..401070582f 100644 --- a/src/lib/routes/index.ts +++ b/src/lib/routes/index.ts @@ -9,7 +9,7 @@ const AdminApi = require('./admin-api'); const ClientApi = require('./client-api'); const Controller = require('./controller'); import { HealthCheckController } from './health-check'; -import ProxyController from './proxy-api'; +import FrontendAPIController from './proxy-api'; import EdgeController from './edge-api'; import { PublicInviteController } from './public-invite'; import { Db } from '../db/db'; @@ -47,7 +47,7 @@ class IndexRouter extends Controller { this.use( '/api/frontend', - new ProxyController(config, services, config.flagResolver).router, + new FrontendAPIController(config, services).router, ); this.use('/edge', new EdgeController(config, services).router); diff --git a/src/lib/routes/proxy-api/index.ts b/src/lib/routes/proxy-api/index.ts index 4fb79901f3..3ac91b7d4d 100644 --- a/src/lib/routes/proxy-api/index.ts +++ b/src/lib/routes/proxy-api/index.ts @@ -1,11 +1,6 @@ import { Request, Response } from 'express'; import Controller from '../controller'; -import { - IFlagResolver, - IUnleashConfig, - IUnleashServices, - NONE, -} from '../../types'; +import { IUnleashConfig, IUnleashServices, NONE } from '../../types'; import { Logger } from '../../logger'; import { IApiUser } from '../../types/api-user'; import { @@ -40,22 +35,15 @@ type Services = Pick< 'settingService' | 'proxyService' | 'openApiService' >; -export default class ProxyController extends Controller { +export default class FrontendAPIController extends Controller { private readonly logger: Logger; private services: Services; - private flagResolver: IFlagResolver; - - constructor( - config: IUnleashConfig, - services: Services, - flagResolver: IFlagResolver, - ) { + constructor(config: IUnleashConfig, services: Services) { super(config); this.logger = config.getLogger('proxy-api/index.ts'); this.services = services; - this.flagResolver = flagResolver; // Support CORS requests for the frontend endpoints. // Preflight requests are handled in `app.ts`. @@ -85,14 +73,14 @@ export default class ProxyController extends Controller { this.route({ method: 'post', path: '', - handler: ProxyController.endpointNotImplemented, + handler: FrontendAPIController.endpointNotImplemented, permission: NONE, }); this.route({ method: 'get', path: '/client/features', - handler: ProxyController.endpointNotImplemented, + handler: FrontendAPIController.endpointNotImplemented, permission: NONE, }); @@ -156,14 +144,14 @@ export default class ProxyController extends Controller { this.route({ method: 'get', path: '/health', - handler: ProxyController.endpointNotImplemented, + handler: FrontendAPIController.endpointNotImplemented, permission: NONE, }); this.route({ method: 'get', path: '/internal-backstage/prometheus', - handler: ProxyController.endpointNotImplemented, + handler: FrontendAPIController.endpointNotImplemented, permission: NONE, }); } @@ -187,7 +175,7 @@ export default class ProxyController extends Controller { } const toggles = await this.services.proxyService.getProxyFeatures( req.user, - ProxyController.createContext(req), + FrontendAPIController.createContext(req), ); res.set('Cache-control', 'no-cache'); diff --git a/src/lib/services/proxy-service.ts b/src/lib/services/proxy-service.ts index 5fea01a3a8..7187d681af 100644 --- a/src/lib/services/proxy-service.ts +++ b/src/lib/services/proxy-service.ts @@ -131,6 +131,7 @@ export class ProxyService { disableMetrics: true, repository, disableAutoStart: true, + skipInstanceCountWarning: true, }); client.on(UnleashEvents.Error, (error) => {