mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
[SG-439] Add feature flags to web (#3092)
* Add feature flags to web * Remove extra file from dev
This commit is contained in:
19
apps/web/src/utils/flags.ts
Normal file
19
apps/web/src/utils/flags.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export type Flags = {
|
||||
showTrial?: boolean;
|
||||
};
|
||||
|
||||
export type FlagName = keyof Flags;
|
||||
|
||||
export function flagEnabled(flag: FlagName): boolean {
|
||||
return flags()[flag] == null || flags()[flag];
|
||||
}
|
||||
|
||||
function flags(): Flags {
|
||||
const envFlags = process.env.FLAGS as string | Flags;
|
||||
|
||||
if (typeof envFlags === "string") {
|
||||
return JSON.parse(envFlags) as Flags;
|
||||
} else {
|
||||
return envFlags as Flags;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user