feat(flags): introduce flags, disable_user_signups

fix #698
This commit is contained in:
Amruth Pillai 2022-03-18 11:12:26 +01:00
parent 910f764823
commit b6267d07ba
No known key found for this signature in database
GPG Key ID: E3C57DF9B80855AD
3 changed files with 9 additions and 2 deletions

View File

@ -27,4 +27,7 @@ GOOGLE_API_KEY=
SENDGRID_API_KEY=
SENDGRID_FORGOT_PASSWORD_TEMPLATE_ID=
SENDGRID_FROM_NAME=
SENDGRID_FROM_EMAIL=
SENDGRID_FROM_EMAIL=
# Flags (Optional)
PUBLIC_FLAG_DISABLE_SIGNUPS=false

View File

@ -0,0 +1,3 @@
import env from '@beam-australia/react-env';
export const FLAG_DISABLE_SIGNUPS = env('FLAG_DISABLE_SIGNUPS') === 'true';

View File

@ -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 = () => {
<>
<Button onClick={handleLogin}>{t('landing.actions.login')}</Button>
<Button variant="outlined" onClick={handleRegister}>
<Button variant="outlined" onClick={handleRegister} disabled={FLAG_DISABLE_SIGNUPS}>
{t('landing.actions.register')}
</Button>
</>