2025-07-17 13:09:24 +02:00
|
|
|
"""
|
|
|
|
|
Gateway configuration
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
from typing import List, Dict
|
2025-07-17 14:34:24 +02:00
|
|
|
from pydantic_settings import BaseSettings
|
2025-07-17 13:09:24 +02:00
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
"""Application settings"""
|
|
|
|
|
|
|
|
|
|
# Basic settings
|
|
|
|
|
APP_NAME: str = "Bakery Forecasting Gateway"
|
|
|
|
|
VERSION: str = "1.0.0"
|
|
|
|
|
DEBUG: bool = os.getenv("DEBUG", "False").lower() == "true"
|
|
|
|
|
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
|
|
|
|
|
|
|
|
|
|
# CORS settings
|
|
|
|
|
CORS_ORIGINS: List[str] = os.getenv("CORS_ORIGINS", "http://localhost:3000,http://localhost:3001").split(",")
|
|
|
|
|
|
|
|
|
|
# Service URLs
|
|
|
|
|
AUTH_SERVICE_URL: str = os.getenv("AUTH_SERVICE_URL", "http://auth-service:8000")
|
|
|
|
|
TRAINING_SERVICE_URL: str = os.getenv("TRAINING_SERVICE_URL", "http://training-service:8000")
|
|
|
|
|
FORECASTING_SERVICE_URL: str = os.getenv("FORECASTING_SERVICE_URL", "http://forecasting-service:8000")
|
|
|
|
|
DATA_SERVICE_URL: str = os.getenv("DATA_SERVICE_URL", "http://data-service:8000")
|
|
|
|
|
TENANT_SERVICE_URL: str = os.getenv("TENANT_SERVICE_URL", "http://tenant-service:8000")
|
|
|
|
|
NOTIFICATION_SERVICE_URL: str = os.getenv("NOTIFICATION_SERVICE_URL", "http://notification-service:8000")
|
|
|
|
|
|
|
|
|
|
# Redis settings
|
|
|
|
|
REDIS_URL: str = os.getenv("REDIS_URL", "redis://redis:6379/6")
|
|
|
|
|
|
|
|
|
|
# Rate limiting
|
|
|
|
|
RATE_LIMIT_REQUESTS: int = int(os.getenv("RATE_LIMIT_REQUESTS", "100"))
|
|
|
|
|
RATE_LIMIT_WINDOW: int = int(os.getenv("RATE_LIMIT_WINDOW", "60"))
|
|
|
|
|
|
|
|
|
|
# JWT settings
|
|
|
|
|
JWT_SECRET_KEY: str = os.getenv("JWT_SECRET_KEY", "your-secret-key-change-in-production")
|
|
|
|
|
JWT_ALGORITHM: str = os.getenv("JWT_ALGORITHM", "HS256")
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def SERVICES(self) -> Dict[str, str]:
|
|
|
|
|
"""Service registry"""
|
|
|
|
|
return {
|
|
|
|
|
"auth": self.AUTH_SERVICE_URL,
|
|
|
|
|
"training": self.TRAINING_SERVICE_URL,
|
|
|
|
|
"forecasting": self.FORECASTING_SERVICE_URL,
|
|
|
|
|
"data": self.DATA_SERVICE_URL,
|
|
|
|
|
"tenant": self.TENANT_SERVICE_URL,
|
|
|
|
|
"notification": self.NOTIFICATION_SERVICE_URL
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
settings = Settings()
|