From dca73bb912983bfe8b0768a4fe070b3b8ac977db Mon Sep 17 00:00:00 2001 From: FinemechanicPub <93194456+FinemechanicPub@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:35:41 +0300 Subject: [PATCH] Fix issue with no superuser settings --- backend/app/core/config.py | 8 ++++---- backend/app/core/init_db.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 13a4058..eabaea8 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -1,4 +1,4 @@ -from typing import Optional +from typing import Literal from pydantic import EmailStr from pydantic_settings import BaseSettings, SettingsConfigDict @@ -8,9 +8,9 @@ class Settings(BaseSettings): app_title: str = "Puzzle game" connection_string: str = "sqlite+aiosqlite://" - secret: str = "SECRET" - first_superuser_email: Optional[EmailStr] = None - first_superuser_password: Optional[str] = None + secret: str = "SECRET2" + first_superuser_email: EmailStr | Literal[""] = "" + first_superuser_password: str = "" unverified_user_can_login: bool = True max_cells: int = 120 page_limit: int = 20 diff --git a/backend/app/core/init_db.py b/backend/app/core/init_db.py index 71025bf..ee5f31f 100644 --- a/backend/app/core/init_db.py +++ b/backend/app/core/init_db.py @@ -37,8 +37,8 @@ async def create_user( async def create_first_superuser(): if ( - settings.first_superuser_email is not None - and settings.first_superuser_password is not None + settings.first_superuser_email + and settings.first_superuser_password ): await create_user( email=settings.first_superuser_email,