25 lines
626 B
Python
25 lines
626 B
Python
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore"
|
|
)
|
|
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "Todo Application"
|
|
|
|
# Database settings
|
|
DB_DIR: Path = Path("/app") / "storage" / "db"
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
def __init__(self, **data):
|
|
super().__init__(**data)
|
|
self.DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
settings = Settings() |