This commit is contained in:
giancarlo
2024-03-24 02:23:22 +08:00
parent 648d77b430
commit bce3479368
589 changed files with 37067 additions and 9596 deletions

View File

@@ -0,0 +1,49 @@
import { z } from 'zod';
const FeatureFlagsSchema = z.object({
enableThemeSwitcher: z.boolean(),
enableAccountDeletion: z.boolean(),
enableOrganizationDeletion: z.boolean(),
enableOrganizationAccounts: z.boolean(),
enableOrganizationCreation: z.boolean(),
enablePersonalAccountBilling: z.boolean(),
enableOrganizationBilling: z.boolean(),
});
const featuresFlagConfig = FeatureFlagsSchema.parse({
enableThemeSwitcher: true,
enableAccountDeletion: getBoolean(
process.env.NEXT_PUBLIC_ENABLE_ACCOUNT_DELETION,
false,
),
enableOrganizationDeletion: getBoolean(
process.env.NEXT_PUBLIC_ENABLE_ORGANIZATION_DELETION,
false,
),
enableOrganizationAccounts: getBoolean(
process.env.NEXT_PUBLIC_ENABLE_ORGANIZATION_ACCOUNTS,
true,
),
enableOrganizationCreation: getBoolean(
process.env.NEXT_PUBLIC_ENABLE_ORGANIZATION_CREATION,
true,
),
enablePersonalAccountBilling: getBoolean(
process.env.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING,
false,
),
enableOrganizationBilling: getBoolean(
process.env.NEXT_PUBLIC_ENABLE_ORGANIZATION_BILLING,
false,
),
});
export default featuresFlagConfig;
function getBoolean(value: unknown, defaultValue: boolean) {
if (typeof value === 'string') {
return value === 'true';
}
return defaultValue;
}