feat: configuration FastAPI et moteur SQLAlchemy async
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
|
||||
|
||||
database_url: str = "postgresql+asyncpg://homehub:homehub@localhost:5432/homehub"
|
||||
upload_dir: str = "/uploads"
|
||||
cors_origins: str = "http://localhost:3000"
|
||||
|
||||
@property
|
||||
def cors_origins_list(self) -> list[str]:
|
||||
return [o.strip() for o in self.cors_origins.split(",")]
|
||||
|
||||
@property
|
||||
def upload_path(self) -> Path:
|
||||
return Path(self.upload_dir)
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user