Files
bakery-ia/gateway/app/core/config.py

47 lines
1.7 KiB
Python
Raw Normal View History

2025-07-19 21:44:52 +02:00
# ================================================================
# GATEWAY SERVICE CONFIGURATION
# gateway/app/core/config.py
# ================================================================
"""
2025-07-19 21:44:52 +02:00
Gateway service configuration
Central API Gateway for all microservices
"""
2025-07-19 21:44:52 +02:00
from shared.config.base import BaseServiceSettings
import os
2025-07-19 21:44:52 +02:00
from typing import Dict, List
2025-07-19 21:44:52 +02:00
class GatewaySettings(BaseServiceSettings):
"""Gateway-specific settings"""
2025-07-19 21:44:52 +02:00
# Service Identity
APP_NAME: str = "Bakery Forecasting Gateway"
2025-07-19 21:44:52 +02:00
SERVICE_NAME: str = "gateway"
DESCRIPTION: str = "API Gateway for Bakery Forecasting Platform"
2025-07-19 21:44:52 +02:00
# Gateway-specific Redis database
REDIS_DB: int = 6
2025-07-17 21:25:27 +02:00
# Service Discovery
CONSUL_URL: str = os.getenv("CONSUL_URL", "http://consul:8500")
ENABLE_SERVICE_DISCOVERY: bool = os.getenv("ENABLE_SERVICE_DISCOVERY", "false").lower() == "true"
2025-07-19 21:44:52 +02:00
# Load Balancing
ENABLE_LOAD_BALANCING: bool = os.getenv("ENABLE_LOAD_BALANCING", "true").lower() == "true"
LOAD_BALANCER_ALGORITHM: str = os.getenv("LOAD_BALANCER_ALGORITHM", "round_robin")
2025-07-19 21:44:52 +02:00
# Circuit Breaker
CIRCUIT_BREAKER_ENABLED: bool = os.getenv("CIRCUIT_BREAKER_ENABLED", "true").lower() == "true"
CIRCUIT_BREAKER_FAILURE_THRESHOLD: int = int(os.getenv("CIRCUIT_BREAKER_FAILURE_THRESHOLD", "5"))
CIRCUIT_BREAKER_RECOVERY_TIMEOUT: int = int(os.getenv("CIRCUIT_BREAKER_RECOVERY_TIMEOUT", "60"))
2025-07-19 21:44:52 +02:00
# Request/Response Settings
MAX_REQUEST_SIZE: int = int(os.getenv("MAX_REQUEST_SIZE", "10485760")) # 10MB
REQUEST_TIMEOUT: int = int(os.getenv("REQUEST_TIMEOUT", "30"))
2025-07-17 19:46:41 +02:00
2025-07-19 21:44:52 +02:00
# Gateway doesn't need a database
DATABASE_URL: str = ""
2025-07-17 19:46:41 +02:00
2025-07-19 21:44:52 +02:00
settings = GatewaySettings()