Merge pull request #14389 from Budibase/fix/feature-flag-checks
Fix for feature flag issue
This commit is contained in:
commit
20baecc9fb
|
@ -159,8 +159,9 @@ export class FlagSet<V extends Flag<any>, T extends { [key: string]: V }> {
|
|||
specificallySetFalse.add(feature)
|
||||
}
|
||||
|
||||
// ignore unknown flags
|
||||
if (!this.isFlagName(feature)) {
|
||||
throw new Error(`Feature: ${feature} is not an allowed option`)
|
||||
continue
|
||||
}
|
||||
|
||||
if (typeof flagValues[feature] !== "boolean") {
|
||||
|
@ -169,7 +170,7 @@ export class FlagSet<V extends Flag<any>, T extends { [key: string]: V }> {
|
|||
|
||||
// @ts-expect-error - TS does not like you writing into a generic type,
|
||||
// but we know that it's okay in this case because it's just an object.
|
||||
flagValues[feature] = value
|
||||
flagValues[feature as keyof FlagValues] = value
|
||||
tags[`flags.${feature}.source`] = "environment"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,9 +67,9 @@ describe("feature flags", () => {
|
|||
expected: flags.defaults(),
|
||||
},
|
||||
{
|
||||
it: "should fail when an environment flag is not recognised",
|
||||
it: "should ignore unknown feature flags",
|
||||
environmentFlags: "default:TEST_BOOLEAN,default:FOO",
|
||||
errorMessage: "Feature: FOO is not an allowed option",
|
||||
expected: { TEST_BOOLEAN: true },
|
||||
},
|
||||
{
|
||||
it: "should be able to read boolean flags from PostHog",
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit bc43c5230520d83f23afb14489aa9a2a92e7cd27
|
||||
Subproject commit 14c89a5b20ee4de07723063458a2437b0dd4f2c9
|
Loading…
Reference in New Issue