fix: add feature flag for domain sharding (#11797)

* fix: add feature flag for domain sharding

* fix review comment

* add comment for speical case
This commit is contained in:
Grace Guo
2020-11-25 11:47:18 -08:00
committed by GitHub
parent 0504cf1a00
commit 4cbf482194
3 changed files with 19 additions and 1 deletions

View File

@@ -16,6 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
import {
initFeatureFlags,
isFeatureEnabled,
FeatureFlag,
} from 'src/featureFlags';
function getDomainsConfig() {
const appContainer = document.getElementById('app');
if (!appContainer) {
@@ -23,8 +29,13 @@ function getDomainsConfig() {
}
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 &&
bootstrapData.common &&
bootstrapData.common.conf &&