Error handling, wildcard feature flags
This commit is contained in:
parent
4f66dc0df3
commit
6e1a30bc60
|
@ -31,20 +31,26 @@ const TENANT_FEATURE_FLAGS = getFeatureFlags()
|
||||||
|
|
||||||
exports.isEnabled = featureFlag => {
|
exports.isEnabled = featureFlag => {
|
||||||
const tenantId = tenancy.getTenantId()
|
const tenantId = tenancy.getTenantId()
|
||||||
|
const flags = exports.getTenantFeatureFlags(tenantId)
|
||||||
return (
|
return flags.includes(featureFlag)
|
||||||
TENANT_FEATURE_FLAGS &&
|
|
||||||
TENANT_FEATURE_FLAGS[tenantId] &&
|
|
||||||
TENANT_FEATURE_FLAGS[tenantId].includes(featureFlag)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getTenantFeatureFlags = tenantId => {
|
exports.getTenantFeatureFlags = tenantId => {
|
||||||
if (TENANT_FEATURE_FLAGS && TENANT_FEATURE_FLAGS[tenantId]) {
|
const flags = []
|
||||||
return TENANT_FEATURE_FLAGS[tenantId]
|
|
||||||
|
if (TENANT_FEATURE_FLAGS) {
|
||||||
|
const globalFlags = TENANT_FEATURE_FLAGS["*"]
|
||||||
|
const tenantFlags = TENANT_FEATURE_FLAGS[tenantId]
|
||||||
|
|
||||||
|
if (globalFlags) {
|
||||||
|
flags.push(...globalFlags)
|
||||||
|
}
|
||||||
|
if (tenantFlags) {
|
||||||
|
flags.push(...tenantFlags)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return []
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.FeatureFlag = {
|
exports.FeatureFlag = {
|
||||||
|
|
|
@ -83,7 +83,6 @@ export const handleSaveEvents = async (
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await events.user.created(user)
|
await events.user.created(user)
|
||||||
await pro.createAccountUser(user)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAddingBuilder(user, existingUser)) {
|
if (isAddingBuilder(user, existingUser)) {
|
||||||
|
|
Loading…
Reference in New Issue