
- Added filtering and pagination for todo listings - Fixed Alembic migration setup - Enhanced CRUD operations - Updated documentation with comprehensive README - Linted code with Ruff
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import secrets
|
|
from typing import List
|
|
|
|
from pydantic import field_validator
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
API_V1_STR: str = "/api/v1"
|
|
SECRET_KEY: str = secrets.token_urlsafe(32)
|
|
# 60 minutes * 24 hours * 8 days = 8 days
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
|
|
# SERVER_NAME: str
|
|
# SERVER_HOST: AnyHttpUrl
|
|
# BACKEND_CORS_ORIGINS is a JSON-formatted list of origins
|
|
# e.g: '["http://localhost", "http://localhost:4200", "http://localhost:3000", \
|
|
# "http://localhost:8080", "http://local.dockertoolbox.tiangolo.com"]'
|
|
BACKEND_CORS_ORIGINS: List[str] = ["*"]
|
|
|
|
@field_validator("BACKEND_CORS_ORIGINS", mode="before")
|
|
@classmethod
|
|
def assemble_cors_origins(cls, v: str | List[str]) -> List[str] | 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)
|
|
|
|
PROJECT_NAME: str = "TodoApp API"
|
|
|
|
class Config:
|
|
case_sensitive = True
|
|
env_file = ".env"
|
|
|
|
|
|
settings = Settings() |