feat(api): use different config parser and disable multi_tenant

This commit is contained in:
Alexander 2024-06-13 11:59:56 +02:00
parent a6c4847ae2
commit 25baa6825e
2 changed files with 5 additions and 7 deletions

View file

@ -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}")

View file

@ -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