From d3a053479858b9b1991b996efb4a54858ccc023c Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 11 Jan 2022 12:31:40 +0000 Subject: [PATCH] Fix: Load apps when using the default multi tenant --- packages/auth/src/db/utils.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 2bad09c306..5830de4721 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -224,8 +224,15 @@ exports.getAllDbs = async () => { } } 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 await addDbs( exports.getStartEndKeyURL(couchUrl, DocumentTypes.APP, tenantId) @@ -236,9 +243,6 @@ exports.getAllDbs = async () => { ) // add global db name dbs.push(getGlobalDBName(tenantId)) - } else { - // just get all DBs in self host - await addDbs(couchUrl) } return dbs }