30 lines
877 B
Python
30 lines
877 B
Python
from pathlib import Path
|
|
from typing import List
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
class Settings(BaseSettings):
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "Simple Cart System"
|
|
PROJECT_DESCRIPTION: str = "A simple cart system API using FastAPI and SQLite"
|
|
PROJECT_VERSION: str = "0.1.0"
|
|
CORS_ORIGINS: List[str] = ["*"]
|
|
|
|
# Database settings
|
|
DB_DIR = Path("/app") / "storage" / "db"
|
|
DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
# Security settings
|
|
SECRET_KEY: str = "supersecretkey" # You should change this in production
|
|
ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
|
|
# CORS configuration
|
|
BACKEND_CORS_ORIGINS: List[str] = ["*"]
|
|
|
|
class Config:
|
|
case_sensitive = True
|
|
env_file = ".env"
|
|
|
|
settings = Settings() |