
- Set up project structure and FastAPI application - Create configuration and security modules - Add API routers and endpoint placeholders - Add health check endpoint - Update README.md with project details
35 lines
894 B
Python
35 lines
894 B
Python
import os
|
|
from pathlib import Path
|
|
from typing import List
|
|
|
|
from pydantic import AnyHttpUrl
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "Food Delivery API"
|
|
VERSION: str = "0.1.0"
|
|
DESCRIPTION: str = "Backend API for a Food Delivery Application"
|
|
|
|
# CORS configuration
|
|
CORS_ORIGINS: List[AnyHttpUrl] = []
|
|
|
|
# JWT secret key
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "supersecretkey")
|
|
ALGORITHM: str = "HS256"
|
|
# 60 minutes * 24 hours * 7 days = 7 days
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7
|
|
|
|
# Database
|
|
DB_DIR = Path("/app") / "storage" / "db"
|
|
DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
class Config:
|
|
case_sensitive = True
|
|
env_file = ".env"
|
|
|
|
|
|
settings = Settings() |