-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathflags.ts
92 lines (85 loc) · 1.98 KB
/
flags.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import { unstable_flag as flag } from "@vercel/flags/next";
function takeLocalEnv(localEnvironemntKey: string) {
if (process.env.NODE_ENV !== "development") {
return false;
}
if (
process.env[localEnvironemntKey] === undefined ||
process.env[localEnvironemntKey] === "false"
) {
return false;
}
return true;
}
export const debugFlag = flag<boolean>({
key: "debug",
async decide() {
return takeLocalEnv("DEBUG_FLAG");
},
description: "Enable debug mode",
defaultValue: false,
options: [
{ value: false, label: "disable" },
{ value: true, label: "Enable" },
],
});
export const viewFlag = flag<boolean>({
key: "view",
async decide() {
return takeLocalEnv("VIEW_FLAG");
},
description: "Enable view mode",
defaultValue: false,
options: [
{ value: false, label: "disable" },
{ value: true, label: "Enable" },
],
});
export const githubIntegrationFlag = flag<boolean>({
key: "github-integration",
async decide() {
return takeLocalEnv("GITHUB_INTEGRATION_FLAG");
},
description: "Enable GitHub Integration",
defaultValue: false,
options: [
{ value: false, label: "disable" },
{ value: true, label: "Enable" },
],
});
export const playgroundV2Flag = flag<boolean>({
key: "playground-v2",
async decide() {
return takeLocalEnv("PLAYGROUND_V2_FLAG");
},
description: "Enable Playground V2",
defaultValue: false,
options: [
{ value: false, label: "disable" },
{ value: true, label: "Enable" },
],
});
export const googleOauthFlag = flag<boolean>({
key: "google-oauth",
async decide() {
return takeLocalEnv("GOOGLE_OAUTH_FLAG");
},
description: "Enable Google OAuth",
defaultValue: false,
options: [
{ value: false, label: "disable" },
{ value: true, label: "Enable" },
],
});
export const developerFlag = flag<boolean>({
key: "developer",
async decide() {
return takeLocalEnv("DEVELOPER_FLAG");
},
description: "Enable Developer",
defaultValue: false,
options: [
{ value: false, label: "disable" },
{ value: true, label: "Enable" },
],
});