-
Notifications
You must be signed in to change notification settings - Fork 9
/
flags.ts
132 lines (122 loc) · 2.84 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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 freePlanFlag = flag<boolean>({
key: "free-plan",
async decide() {
return true;
// return takeLocalEnv("FREE_PLAN_FLAG");
},
description: "Enable Free Plan",
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 proTeamPlanFlag = flag<boolean>({
key: "pro-team-plan",
async decide() {
return takeLocalEnv("PRO_TEAM_PLAN_FLAG");
},
description: "Enable Pro Team Plan",
defaultValue: false,
options: [
{ value: false, label: "disable" },
{ value: true, label: "Enable" },
],
});
export const teamCreationFlag = flag<boolean>({
key: "team-creation",
async decide() {
return takeLocalEnv("TEAM_CREATION_FLAG");
},
description: "Enable Team Creation",
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" },
],
});