todoapi-f42fit/app/core/config.py
Automated Action 53566813bd Complete Todo API implementation with FastAPI and SQLite
- Add SQLite database configuration
- Create Todo model, schemas, and CRUD operations
- Implement Todo API endpoints
- Add Alembic migration for todo table
- Set up database initialization in main.py
- Update README with project details and instructions
- Add pyproject.toml with Ruff configuration
2025-06-10 15:40:42 +00:00

26 lines
685 B
Python

from pydantic import validator
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
API_V1_STR: str = "/api/v1"
PROJECT_NAME: str = "Todo API"
VERSION: str = "0.1.0"
# CORS Configuration
BACKEND_CORS_ORIGINS: list[str] = ["*"]
@validator("BACKEND_CORS_ORIGINS", pre=True)
def assemble_cors_origins(cls, v: list[str]) -> list[str]:
if isinstance(v, str) and not v.startswith("["):
return [i.strip() for i in v.split(",")]
elif isinstance(v, (list, str)):
return v
raise ValueError(v)
class Config:
env_file = ".env"
case_sensitive = True
settings = Settings()