67 lines
2.0 KiB
Python
67 lines
2.0 KiB
Python
# services/inventory/app/core/config.py
|
|
"""
|
|
Inventory Service Configuration
|
|
"""
|
|
|
|
from typing import List
|
|
from pydantic import Field
|
|
from shared.config.base import BaseServiceSettings
|
|
|
|
|
|
class Settings(BaseServiceSettings):
|
|
"""Inventory service settings extending base configuration"""
|
|
|
|
# Override service-specific settings
|
|
SERVICE_NAME: str = "inventory-service"
|
|
VERSION: str = "1.0.0"
|
|
APP_NAME: str = "Bakery Inventory Service"
|
|
DESCRIPTION: str = "Inventory and stock management service"
|
|
|
|
# API Configuration
|
|
API_V1_STR: str = "/api/v1"
|
|
|
|
# Override database URL to use INVENTORY_DATABASE_URL
|
|
DATABASE_URL: str = Field(
|
|
default="postgresql+asyncpg://inventory_user:inventory_pass123@inventory-db:5432/inventory_db",
|
|
env="INVENTORY_DATABASE_URL"
|
|
)
|
|
|
|
# Inventory-specific Redis database
|
|
REDIS_DB: int = Field(default=3, env="INVENTORY_REDIS_DB")
|
|
|
|
# File upload configuration
|
|
MAX_UPLOAD_SIZE: int = 10 * 1024 * 1024 # 10MB
|
|
UPLOAD_PATH: str = Field(default="/tmp/uploads", env="INVENTORY_UPLOAD_PATH")
|
|
ALLOWED_FILE_EXTENSIONS: List[str] = [".csv", ".xlsx", ".xls", ".png", ".jpg", ".jpeg"]
|
|
|
|
# Pagination
|
|
DEFAULT_PAGE_SIZE: int = 50
|
|
MAX_PAGE_SIZE: int = 1000
|
|
|
|
# Stock validation
|
|
MIN_QUANTITY: float = 0.0
|
|
MAX_QUANTITY: float = 100000.0
|
|
MIN_PRICE: float = 0.01
|
|
MAX_PRICE: float = 10000.0
|
|
|
|
# Inventory-specific cache TTL
|
|
INVENTORY_CACHE_TTL: int = 180 # 3 minutes for real-time stock
|
|
INGREDIENT_CACHE_TTL: int = 600 # 10 minutes
|
|
SUPPLIER_CACHE_TTL: int = 1800 # 30 minutes
|
|
|
|
# Low stock thresholds
|
|
DEFAULT_LOW_STOCK_THRESHOLD: int = 10
|
|
DEFAULT_REORDER_POINT: int = 20
|
|
DEFAULT_REORDER_QUANTITY: int = 50
|
|
|
|
# Expiration alert thresholds (in days)
|
|
EXPIRING_SOON_DAYS: int = 7
|
|
EXPIRED_ALERT_DAYS: int = 1
|
|
|
|
# Barcode/QR configuration
|
|
BARCODE_FORMAT: str = "Code128"
|
|
QR_CODE_VERSION: int = 1
|
|
|
|
|
|
# Global settings instance
|
|
settings = Settings() |