Fix: Load apps when using the default multi tenant

This commit is contained in:
Rory Powell 2022-01-11 12:31:40 +00:00
parent f74090d2eb
commit d3a0534798
1 changed files with 9 additions and 5 deletions

View File

@ -224,8 +224,15 @@ exports.getAllDbs = async () => {
} }
} }
let couchUrl = `${exports.getCouchUrl()}/_all_dbs` let couchUrl = `${exports.getCouchUrl()}/_all_dbs`
if (env.MULTI_TENANCY) { let tenantId = getTenantId()
let tenantId = getTenantId() if (!env.MULTI_TENANCY || tenantId == DEFAULT_TENANT_ID) {
// just get all DBs when:
// - single tenancy
// - default tenant
// - apps dbs don't contain tenant id
// - non-default tenant dbs are filtered out application side in getAllApps
await addDbs(couchUrl)
} else {
// get prod apps // get prod apps
await addDbs( await addDbs(
exports.getStartEndKeyURL(couchUrl, DocumentTypes.APP, tenantId) exports.getStartEndKeyURL(couchUrl, DocumentTypes.APP, tenantId)
@ -236,9 +243,6 @@ exports.getAllDbs = async () => {
) )
// add global db name // add global db name
dbs.push(getGlobalDBName(tenantId)) dbs.push(getGlobalDBName(tenantId))
} else {
// just get all DBs in self host
await addDbs(couchUrl)
} }
return dbs return dbs
} }