From b6267d07ba2dcaed0da3946d136a0a9a01c441d5 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Fri, 18 Mar 2022 11:12:26 +0100 Subject: [PATCH] feat(flags): introduce flags, disable_user_signups fix #698 --- .env.example | 5 ++++- client/constants/flags.ts | 3 +++ client/pages/index.tsx | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 client/constants/flags.ts diff --git a/.env.example b/.env.example index f31381e2..402cfdea 100644 --- a/.env.example +++ b/.env.example @@ -27,4 +27,7 @@ GOOGLE_API_KEY= SENDGRID_API_KEY= SENDGRID_FORGOT_PASSWORD_TEMPLATE_ID= SENDGRID_FROM_NAME= -SENDGRID_FROM_EMAIL= \ No newline at end of file +SENDGRID_FROM_EMAIL= + +# Flags (Optional) +PUBLIC_FLAG_DISABLE_SIGNUPS=false \ No newline at end of file diff --git a/client/constants/flags.ts b/client/constants/flags.ts new file mode 100644 index 00000000..f78838b7 --- /dev/null +++ b/client/constants/flags.ts @@ -0,0 +1,3 @@ +import env from '@beam-australia/react-env'; + +export const FLAG_DISABLE_SIGNUPS = env('FLAG_DISABLE_SIGNUPS') === 'true'; diff --git a/client/pages/index.tsx b/client/pages/index.tsx index 0b578209..ef6e5b4c 100644 --- a/client/pages/index.tsx +++ b/client/pages/index.tsx @@ -13,6 +13,7 @@ import LanguageSwitcher from '@/components/shared/LanguageSwitcher'; import Logo from '@/components/shared/Logo'; import NoSSR from '@/components/shared/NoSSR'; import { screenshots } from '@/config/screenshots'; +import { FLAG_DISABLE_SIGNUPS } from '@/constants/flags'; import testimonials from '@/data/testimonials'; import { logout } from '@/store/auth/authSlice'; import { setTheme } from '@/store/build/buildSlice'; @@ -74,7 +75,7 @@ const Home: NextPage = () => { <> -