Skip to content

Commit 6ee0e41

Browse files
authored
feat(cubejs-server-core): add contextToCubeStoreRouterId config option (#9197)
1 parent eff0736 commit 6ee0e41

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

packages/cubejs-server-core/src/core/optionsValidate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const schemaOptions = Joi.object().keys({
7474
contextToAppId: Joi.func(),
7575
contextToRoles: Joi.func(),
7676
contextToOrchestratorId: Joi.func(),
77+
contextToCubeStoreRouterId: Joi.func(),
7778
contextToDataSourceId: Joi.func(),
7879
contextToApiScopes: Joi.func(),
7980
repositoryFactory: Joi.func(),

packages/cubejs-server-core/src/core/server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import type {
5959
LoggerFn,
6060
DriverConfig,
6161
ScheduledRefreshTimeZonesFn,
62+
ContextToCubeStoreRouterIdFn,
6263
} from './types';
6364
import {
6465
ContextToOrchestratorIdFn,
@@ -137,6 +138,8 @@ export class CubejsServerCore {
137138

138139
protected readonly contextToOrchestratorId: ContextToOrchestratorIdFn;
139140

141+
protected readonly contextToCubeStoreRouterId: ContextToCubeStoreRouterIdFn | null;
142+
140143
protected readonly preAggregationsSchema: PreAggregationsSchemaFn;
141144

142145
protected readonly scheduledRefreshTimeZones: ScheduledRefreshTimeZonesFn;
@@ -216,6 +219,7 @@ export class CubejsServerCore {
216219
}
217220

218221
this.contextToOrchestratorId = this.options.contextToOrchestratorId || (() => 'STANDALONE');
222+
this.contextToCubeStoreRouterId = this.options.contextToCubeStoreRouterId;
219223

220224
// proactively free up old cache values occasionally
221225
if (this.options.maxCompilerCacheKeepAlive) {

packages/cubejs-server-core/src/core/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export type DatabaseType =
123123
export type ContextToAppIdFn = (context: RequestContext) => string | Promise<string>;
124124
export type ContextToRolesFn = (context: RequestContext) => string[] | Promise<string[]>;
125125
export type ContextToOrchestratorIdFn = (context: RequestContext) => string | Promise<string>;
126+
export type ContextToCubeStoreRouterIdFn = (context: RequestContext) => string | Promise<string>;
126127

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

@@ -190,6 +191,7 @@ export interface CreateOptions {
190191
contextToAppId?: ContextToAppIdFn;
191192
contextToRoles?: ContextToRolesFn;
192193
contextToOrchestratorId?: ContextToOrchestratorIdFn;
194+
contextToCubeStoreRouterId?: ContextToCubeStoreRouterIdFn;
193195
contextToApiScopes?: ContextToApiScopesFn;
194196
repositoryFactory?: (context: RequestContext) => SchemaFileRepository;
195197
checkAuth?: CheckAuthFn;

0 commit comments

Comments
 (0)