72 lines
3.6 KiB
Python
72 lines
3.6 KiB
Python
|
|
# ================================================================
|
||
|
|
# services/orders/app/core/config.py
|
||
|
|
# ================================================================
|
||
|
|
"""
|
||
|
|
Orders Service Configuration
|
||
|
|
"""
|
||
|
|
|
||
|
|
import os
|
||
|
|
from shared.config.base import BaseServiceSettings
|
||
|
|
|
||
|
|
|
||
|
|
class OrdersSettings(BaseServiceSettings):
|
||
|
|
"""Orders service specific settings"""
|
||
|
|
|
||
|
|
# Service Identity
|
||
|
|
APP_NAME: str = "Orders Service"
|
||
|
|
SERVICE_NAME: str = "orders-service"
|
||
|
|
VERSION: str = "1.0.0"
|
||
|
|
DESCRIPTION: str = "Customer orders and procurement planning"
|
||
|
|
|
||
|
|
# Database Configuration
|
||
|
|
DATABASE_URL: str = os.getenv("ORDERS_DATABASE_URL",
|
||
|
|
"postgresql+asyncpg://orders_user:orders_pass123@orders-db:5432/orders_db")
|
||
|
|
|
||
|
|
# Order Processing
|
||
|
|
ORDER_PROCESSING_ENABLED: bool = os.getenv("ORDER_PROCESSING_ENABLED", "true").lower() == "true"
|
||
|
|
AUTO_APPROVE_ORDERS: bool = os.getenv("AUTO_APPROVE_ORDERS", "false").lower() == "true"
|
||
|
|
MAX_ORDER_ITEMS: int = int(os.getenv("MAX_ORDER_ITEMS", "50"))
|
||
|
|
|
||
|
|
# Procurement Planning
|
||
|
|
PROCUREMENT_PLANNING_ENABLED: bool = os.getenv("PROCUREMENT_PLANNING_ENABLED", "true").lower() == "true"
|
||
|
|
PROCUREMENT_LEAD_TIME_DAYS: int = int(os.getenv("PROCUREMENT_LEAD_TIME_DAYS", "3"))
|
||
|
|
DEMAND_FORECAST_DAYS: int = int(os.getenv("DEMAND_FORECAST_DAYS", "14"))
|
||
|
|
SAFETY_STOCK_PERCENTAGE: float = float(os.getenv("SAFETY_STOCK_PERCENTAGE", "20.0"))
|
||
|
|
|
||
|
|
# Business Model Detection
|
||
|
|
ENABLE_BUSINESS_MODEL_DETECTION: bool = os.getenv("ENABLE_BUSINESS_MODEL_DETECTION", "true").lower() == "true"
|
||
|
|
CENTRAL_BAKERY_ORDER_THRESHOLD: int = int(os.getenv("CENTRAL_BAKERY_ORDER_THRESHOLD", "20"))
|
||
|
|
INDIVIDUAL_BAKERY_ORDER_THRESHOLD: int = int(os.getenv("INDIVIDUAL_BAKERY_ORDER_THRESHOLD", "5"))
|
||
|
|
|
||
|
|
# Customer Management
|
||
|
|
CUSTOMER_VALIDATION_ENABLED: bool = os.getenv("CUSTOMER_VALIDATION_ENABLED", "true").lower() == "true"
|
||
|
|
MAX_CUSTOMERS_PER_TENANT: int = int(os.getenv("MAX_CUSTOMERS_PER_TENANT", "10000"))
|
||
|
|
CUSTOMER_CREDIT_CHECK_ENABLED: bool = os.getenv("CUSTOMER_CREDIT_CHECK_ENABLED", "false").lower() == "true"
|
||
|
|
|
||
|
|
# Order Validation
|
||
|
|
MIN_ORDER_VALUE: float = float(os.getenv("MIN_ORDER_VALUE", "0.0"))
|
||
|
|
MAX_ORDER_VALUE: float = float(os.getenv("MAX_ORDER_VALUE", "100000.0"))
|
||
|
|
VALIDATE_PRODUCT_AVAILABILITY: bool = os.getenv("VALIDATE_PRODUCT_AVAILABILITY", "true").lower() == "true"
|
||
|
|
|
||
|
|
|
||
|
|
# Payment and Pricing
|
||
|
|
PAYMENT_VALIDATION_ENABLED: bool = os.getenv("PAYMENT_VALIDATION_ENABLED", "true").lower() == "true"
|
||
|
|
DYNAMIC_PRICING_ENABLED: bool = os.getenv("DYNAMIC_PRICING_ENABLED", "false").lower() == "true"
|
||
|
|
DISCOUNT_ENABLED: bool = os.getenv("DISCOUNT_ENABLED", "true").lower() == "true"
|
||
|
|
MAX_DISCOUNT_PERCENTAGE: float = float(os.getenv("MAX_DISCOUNT_PERCENTAGE", "50.0"))
|
||
|
|
|
||
|
|
# Delivery and Fulfillment
|
||
|
|
DELIVERY_TRACKING_ENABLED: bool = os.getenv("DELIVERY_TRACKING_ENABLED", "true").lower() == "true"
|
||
|
|
DEFAULT_DELIVERY_WINDOW_HOURS: int = int(os.getenv("DEFAULT_DELIVERY_WINDOW_HOURS", "48"))
|
||
|
|
PICKUP_ENABLED: bool = os.getenv("PICKUP_ENABLED", "true").lower() == "true"
|
||
|
|
DELIVERY_ENABLED: bool = os.getenv("DELIVERY_ENABLED", "true").lower() == "true"
|
||
|
|
|
||
|
|
# Integration Settings
|
||
|
|
PRODUCTION_SERVICE_URL: str = os.getenv("PRODUCTION_SERVICE_URL", "http://production-service:8000")
|
||
|
|
INVENTORY_SERVICE_URL: str = os.getenv("INVENTORY_SERVICE_URL", "http://inventory-service:8000")
|
||
|
|
SUPPLIERS_SERVICE_URL: str = os.getenv("SUPPLIERS_SERVICE_URL", "http://suppliers-service:8000")
|
||
|
|
SALES_SERVICE_URL: str = os.getenv("SALES_SERVICE_URL", "http://sales-service:8000")
|
||
|
|
|
||
|
|
|
||
|
|
# Global settings instance
|
||
|
|
settings = OrdersSettings()
|