From 8e51ea8c2f544128df49ccc62754a847c34e7bcb Mon Sep 17 00:00:00 2001 From: erik_ritter Date: Wed, 20 Oct 2021 17:44:42 -0700 Subject: [PATCH] feat: support disabling domain sharding with a query param --- superset-frontend/src/utils/hostNamesConfig.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/utils/hostNamesConfig.js b/superset-frontend/src/utils/hostNamesConfig.js index 8a9f208cc303e..f2a1638cc7756 100644 --- a/superset-frontend/src/utils/hostNamesConfig.js +++ b/superset-frontend/src/utils/hostNamesConfig.js @@ -28,12 +28,22 @@ function getDomainsConfig() { return []; } + const availableDomains = new Set([window.location.hostname]); + + // don't do domain sharding if a certain query param is set + const disableDomainSharding = + new URLSearchParams(window.location.search).get('disableDomainSharding') === + '1'; + if (disableDomainSharding) { + return Array.from(availableDomains); + } + const bootstrapData = JSON.parse(appContainer.getAttribute('data-bootstrap')); // this module is a little special, it may be loaded before index.jsx, // where window.featureFlags get initialized // eslint-disable-next-line camelcase initFeatureFlags(bootstrapData?.common?.feature_flags); - const availableDomains = new Set([window.location.hostname]); + if ( isFeatureEnabled(FeatureFlag.ALLOW_DASHBOARD_DOMAIN_SHARDING) && bootstrapData &&