Skip to content

Commit 8ff7e4c

Browse files
committed
docs(config): improve documentation for contextToOrchestratorId()
1 parent f7dccd1 commit 8ff7e4c

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

docs/content/Configuration/Config.mdx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,25 @@ module.exports = {
191191

192192
### <--{"id" : "Options Reference"}--> contextToOrchestratorId
193193

194-
`contextToOrchestratorId` is a function to determine a caching key for Query
195-
Orchestrator instance. Query Orchestrator instance holds database connections,
196-
execution queues, pre-aggregation table caches. By default, returns the same
197-
value as `contextToAppId`.
194+
<WarningBox>
195+
196+
In versions of Cube.js prior to v0.29, each tenant would have an individual
197+
instance of the Query Orchestrator.
198198

199-
Override it only in case multiple tenants should share the same execution queue
200-
and database connections while having different schemas instead of default Query
201-
Orchestrator per tenant strategy.
199+
</WarningBox>
200+
201+
`contextToOrchestratorId` is a function used to determine a caching key for the
202+
Query Orchestrator instance. The Query Orchestrator holds database connections,
203+
execution queues, pre-aggregation table caches. By default, the same instance is
204+
used for **all** tenants; override this property in situations where each tenant
205+
requires their own Query Orchestrator.
202206

203207
Called on each request.
204208

205209
```javascript
206210
module.exports = {
207211
contextToAppId: ({ securityContext }) =>
208-
`CUBEJS_APP_${securityContext.tenantId}_${securityContext.user_id}`,
212+
`CUBEJS_APP_${securityContext.tenantId}`,
209213
contextToOrchestratorId: ({ securityContext }) =>
210214
`CUBEJS_APP_${securityContext.tenantId}`,
211215
};
@@ -266,8 +270,10 @@ module.exports = {
266270

267271
### <--{"id" : "Options Reference"}--> checkSqlAuth
268272

269-
Used in [SQL API][ref-sql-api], and can be an `async` function. Default implementation verify username & password from environment variables: `CUBE_SQL_USERNAME`, `CUBE_SQL_PASSWORD`,
270-
but in [development mode][ref-development-mode] it ignores validation.
273+
Used in [SQL API][ref-sql-api], and can be an `async` function. Default
274+
implementation verify username & password from environment variables:
275+
`CUBE_SQL_USERNAME`, `CUBE_SQL_PASSWORD`, but in [development
276+
mode][ref-development-mode] it ignores validation.
271277

272278
Called on each request from Cube SQL API.
273279

@@ -480,9 +486,10 @@ values that your extendContext object key can have.
480486

481487
<WarningBox>
482488

483-
`extendContext` is applied only to requests that go through API.
484-
It isn't applied to refresh worker execution.
485-
If you're looking for a way to provide global environment variables for your schema please see [Execution environment docs][ref-exec-environment-globals].
489+
`extendContext` is applied only to requests that go through API. It isn't
490+
applied to refresh worker execution. If you're looking for a way to provide
491+
global environment variables for your schema please see [Execution environment
492+
docs][ref-exec-environment-globals].
486493

487494
</WarningBox>
488495

@@ -733,4 +740,5 @@ the additional transpiler for check duplicates.
733740
[self-repofactory]: #repositoryFactory
734741
[self-schemafilerepo]: #SchemaFileRepository
735742
[self-schemapath]: #schemaPath
736-
[ref-exec-environment-globals]: /schema/reference/execution-environment#node-js-globals-process-env-console-log-and-others
743+
[ref-exec-environment-globals]:
744+
/schema/reference/execution-environment#node-js-globals-process-env-console-log-and-others

docs/content/Configuration/Multitenancy-Setup.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ your multitenancy setup. You can use all of them or just a couple, depending on
1414
your specific case. The options are:
1515

1616
- `contextToAppId`
17+
- `contextToOrchestratorId`
1718
- `dbType`
1819
- `driverFactory`
1920
- `repositoryFactory`

0 commit comments

Comments
 (0)