-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathcube.js
33 lines (27 loc) · 1.08 KB
/
cube.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// https://cube.dev/docs/multitenancy-setup#multiple-db-instances-with-same-schema
const PostgresDriver = require('@cubejs-backend/postgres-driver');
const DuckDbDriver = require('@cubejs-backend/duckdb-driver');
module.exports = {
contextToAppId: ({ securityContext }) =>
`CUBEJS_APP_${securityContext && securityContext.database ? securityContext.database : 'coopcycle'}`,
contextToOrchestratorId: ({ securityContext }) =>
`CUBEJS_APP_${securityContext && securityContext.database ? securityContext.database : 'coopcycle'}`,
driverFactory: ({ securityContext, dataSource }) => {
if (dataSource === 'duckdb') {
return new DuckDbDriver({})
}
return new PostgresDriver({
database: `${securityContext && securityContext.database ? securityContext.database : 'coopcycle'}`,
})
},
// https://cube.dev/docs/config#options-reference-scheduled-refresh-contexts
scheduledRefreshContexts: () => [
{
securityContext: {
database: 'coopcycle',
base_url: 'http://nginx',
s3_path: '/images/exports/%type%'
},
},
],
};