
- Created FastAPI application with SQLite database - Implemented models for inventory items, categories, suppliers, and transactions - Added authentication system with JWT tokens - Implemented CRUD operations for all models - Set up Alembic for database migrations - Added comprehensive API documentation - Configured Ruff for code linting
31 lines
914 B
Python
31 lines
914 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""
|
|
Application settings class that loads configuration from environment variables.
|
|
"""
|
|
# API details
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "Small Business Inventory Management System"
|
|
PROJECT_DESCRIPTION: str = "API for managing inventory in small businesses"
|
|
PROJECT_VERSION: str = "0.1.0"
|
|
|
|
# Security
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "super-secret-key-for-development-only")
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "60"))
|
|
ALGORITHM: str = "HS256"
|
|
|
|
# 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
|
|
|
|
|
|
settings = Settings() |