From 25baa6825e6ee30ca1d3da830e4bf8bb93862ad1 Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 13 Jun 2024 11:59:56 +0200 Subject: [PATCH] feat(api): use different config parser and disable multi_tenant --- ee/api/chalicelib/core/signup.py | 2 -- ee/api/routers/core_dynamic.py | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ee/api/chalicelib/core/signup.py b/ee/api/chalicelib/core/signup.py index 9e5fb1ad4..32b02f7bf 100644 --- a/ee/api/chalicelib/core/signup.py +++ b/ee/api/chalicelib/core/signup.py @@ -103,8 +103,6 @@ async def create_tenant(data: schemas.UserSignupSchema): async def create_oauth_tenant(fullname: str, email: str): logger.info(f"==== Signup oauth started at {TimeUTC.to_human_readable(TimeUTC.now())} UTC") errors = [] - if not config("MULTI_TENANTS", cast=bool, default=False) and await tenants.tenants_exists(): - return {"errors": ["tenants already registered"]} logger.debug(f"email: {email}") diff --git a/ee/api/routers/core_dynamic.py b/ee/api/routers/core_dynamic.py index bb033b7ad..c9af327e0 100644 --- a/ee/api/routers/core_dynamic.py +++ b/ee/api/routers/core_dynamic.py @@ -58,12 +58,12 @@ if config("MULTI_TENANTS", cast=bool, default=False) or not tenants.tenants_exis # Environment variables (ensure these are set) -GOOGLE_CLIENT_ID = os.getenv("GOOGLE_CLIENT_ID") -GOOGLE_CLIENT_SECRET = os.getenv("GOOGLE_CLIENT_SECRET") -GOOGLE_REDIRECT_URI = os.getenv("GOOGLE_REDIRECT_URI") +GOOGLE_CLIENT_ID = config("GOOGLE_CLIENT_ID") +GOOGLE_CLIENT_SECRET = config("GOOGLE_CLIENT_SECRET") +GOOGLE_REDIRECT_URI = config("GOOGLE_REDIRECT_URI") -if config("MULTI_TENANTS", cast=bool, default=False) or not tenants.tenants_exists_sync(use_pool=False): +if True or config("MULTI_TENANTS", cast=bool, default=False) or not tenants.tenants_exists_sync(use_pool=False): @public_app.get('/signup-oauth', tags=['signup']) async def signup_oauth_handler(): google_authorization_url = ( @@ -76,7 +76,7 @@ if config("MULTI_TENANTS", cast=bool, default=False) or not tenants.tenants_exis return RedirectResponse(url=google_authorization_url) -if config("MULTI_TENANTS", cast=bool, default=False) or not tenants.tenants_exists_sync(use_pool=False): +if True or config("MULTI_TENANTS", cast=bool, default=False) or not tenants.tenants_exists_sync(use_pool=False): @public_app.get('/signup-oauth-callback', tags=['signup']) async def signup_oauth_callback_handler(code: str): # Exchange code for token