Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cubejs-server-core/src/core/optionsValidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const schemaOptions = Joi.object().keys({
contextToAppId: Joi.func(),
contextToRoles: Joi.func(),
contextToOrchestratorId: Joi.func(),
contextToCubeStoreRouterId: Joi.func(),
contextToDataSourceId: Joi.func(),
contextToApiScopes: Joi.func(),
repositoryFactory: Joi.func(),
Expand Down
5 changes: 5 additions & 0 deletions packages/cubejs-server-core/src/core/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ import type {
DriverContext,
LoggerFn,
DriverConfig,
ContextToCubeStoreRouterIdFn,
} from './types';

import { ContextToOrchestratorIdFn, ContextAcceptanceResult, ContextAcceptanceResultHttp, ContextAcceptanceResultWs, ContextAcceptor } from './types';

const { version } = require('../../../package.json');
Expand Down Expand Up @@ -117,6 +119,8 @@ export class CubejsServerCore {

protected readonly contextToOrchestratorId: ContextToOrchestratorIdFn;

protected readonly contextToCubeStoreRouterId: ContextToCubeStoreRouterIdFn | null;

protected readonly preAggregationsSchema: PreAggregationsSchemaFn;

protected readonly orchestratorOptions: OrchestratorOptionsFn;
Expand Down Expand Up @@ -192,6 +196,7 @@ export class CubejsServerCore {
}

this.contextToOrchestratorId = this.options.contextToOrchestratorId || (() => 'STANDALONE');
this.contextToCubeStoreRouterId = this.options.contextToCubeStoreRouterId;

// proactively free up old cache values occasionally
if (this.options.maxCompilerCacheKeepAlive) {
Expand Down
2 changes: 2 additions & 0 deletions packages/cubejs-server-core/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export type DatabaseType =
export type ContextToAppIdFn = (context: RequestContext) => string | Promise<string>;
export type ContextToRolesFn = (context: RequestContext) => string[] | Promise<string[]>;
export type ContextToOrchestratorIdFn = (context: RequestContext) => string | Promise<string>;
export type ContextToCubeStoreRouterIdFn = (context: RequestContext) => string | Promise<string>;

export type OrchestratorOptionsFn = (context: RequestContext) => OrchestratorOptions | Promise<OrchestratorOptions>;

Expand Down Expand Up @@ -179,6 +180,7 @@ export interface CreateOptions {
contextToAppId?: ContextToAppIdFn;
contextToRoles?: ContextToRolesFn;
contextToOrchestratorId?: ContextToOrchestratorIdFn;
contextToCubeStoreRouterId?: ContextToCubeStoreRouterIdFn;
contextToApiScopes?: ContextToApiScopesFn;
repositoryFactory?: (context: RequestContext) => SchemaFileRepository;
checkAuth?: CheckAuthFn;
Expand Down
Loading