@@ -5,7 +5,7 @@ import LRUCache from 'lru-cache';
55import isDocker from 'is-docker' ;
66import pLimit from 'p-limit' ;
77
8- import { ApiGateway , UserBackgroundContext } from '@cubejs-backend/api-gateway' ;
8+ import { ApiGateway , ApiGatewayOptions , UserBackgroundContext } from '@cubejs-backend/api-gateway' ;
99import {
1010 CancelableInterval ,
1111 createCancelableInterval , formatDuration , getAnonymousId ,
@@ -435,7 +435,7 @@ export class CubejsServerCore {
435435 return this . apiGatewayInstance ;
436436 }
437437
438- return ( this . apiGatewayInstance = new ApiGateway (
438+ return ( this . apiGatewayInstance = this . createApiGatewayInstance (
439439 this . options . apiSecret ,
440440 this . getCompilerApi . bind ( this ) ,
441441 this . getOrchestratorApi . bind ( this ) ,
@@ -461,6 +461,16 @@ export class CubejsServerCore {
461461 ) ) ;
462462 }
463463
464+ protected createApiGatewayInstance (
465+ apiSecret : string ,
466+ getCompilerApi : ( context : RequestContext ) => CompilerApi ,
467+ getOrchestratorApi : ( context : RequestContext ) => OrchestratorApi ,
468+ logger : LoggerFn ,
469+ options : ApiGatewayOptions
470+ ) : ApiGateway {
471+ return new ApiGateway ( apiSecret , getCompilerApi , getOrchestratorApi , logger , options ) ;
472+ }
473+
464474 protected async contextRejectionMiddleware ( req , res , next ) {
465475 if ( ! this . standalone ) {
466476 const result = this . contextAcceptor . shouldAcceptHttp ( req . context ) ;
0 commit comments