diff --git a/lkeep/core/__init__.py b/lkeep/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lkeep/core/settings.py b/lkeep/core/settings.py new file mode 100644 index 0000000..6124d1f --- /dev/null +++ b/lkeep/core/settings.py @@ -0,0 +1,24 @@ +from pydantic import SecretStr +from pydantic_settings import BaseSettings, SettingsConfigDict + + +class DBSettings(BaseSettings): + db_name: str + db_user: str + db_password: SecretStr + db_host: str + db_port: int + db_echo: bool + + model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf8", extra="ignore") + + @property + def db_url(self): + return f"postgresql+asyncpg://{self.db_user}:{self.db_password.get_secret_value()}@{self.db_host}:{self.db_port}/{self.db_name}" + + +class Settings(BaseSettings): + db_settings: DBSettings = DBSettings() + + +settings = Settings() diff --git a/lkeep/main.py b/lkeep/main.py index 1907c22..3cf304b 100644 --- a/lkeep/main.py +++ b/lkeep/main.py @@ -1,8 +1,8 @@ +import uvicorn from fastapi import FastAPI app = FastAPI() -@app.get("/") -async def index(): - return {"status": "It's ALIVE!"} +def start(): + uvicorn.run(app="lkeep.main:app", reload=True)