2025-07-17 13:09:24 +02:00
|
|
|
"""
|
|
|
|
|
Training service configuration
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import os
|
2025-07-17 14:34:24 +02:00
|
|
|
from pydantic_settings import BaseSettings
|
2025-07-19 21:16:25 +02:00
|
|
|
from typing import List
|
2025-07-17 13:09:24 +02:00
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
"""Application settings"""
|
|
|
|
|
|
|
|
|
|
# Basic settings
|
|
|
|
|
APP_NAME: str = "Training Service"
|
|
|
|
|
VERSION: str = "1.0.0"
|
|
|
|
|
DEBUG: bool = os.getenv("DEBUG", "False").lower() == "true"
|
|
|
|
|
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
|
|
|
|
|
|
|
|
|
|
# Database settings
|
|
|
|
|
DATABASE_URL: str = os.getenv("DATABASE_URL", "postgresql+asyncpg://training_user:training_pass123@training-db:5432/training_db")
|
|
|
|
|
|
|
|
|
|
# Redis settings
|
|
|
|
|
REDIS_URL: str = os.getenv("REDIS_URL", "redis://redis:6379/1")
|
|
|
|
|
|
|
|
|
|
# RabbitMQ settings
|
|
|
|
|
RABBITMQ_URL: str = os.getenv("RABBITMQ_URL", "amqp://bakery:forecast123@rabbitmq:5672/")
|
|
|
|
|
|
|
|
|
|
# Service URLs
|
|
|
|
|
AUTH_SERVICE_URL: str = os.getenv("AUTH_SERVICE_URL", "http://auth-service:8000")
|
|
|
|
|
DATA_SERVICE_URL: str = os.getenv("DATA_SERVICE_URL", "http://data-service:8000")
|
|
|
|
|
|
|
|
|
|
# ML Settings
|
|
|
|
|
MODEL_STORAGE_PATH: str = os.getenv("MODEL_STORAGE_PATH", "/app/models")
|
|
|
|
|
MAX_TRAINING_TIME_MINUTES: int = int(os.getenv("MAX_TRAINING_TIME_MINUTES", "30"))
|
|
|
|
|
MIN_TRAINING_DATA_DAYS: int = int(os.getenv("MIN_TRAINING_DATA_DAYS", "30"))
|
|
|
|
|
|
|
|
|
|
# Prophet Settings
|
|
|
|
|
PROPHET_SEASONALITY_MODE: str = os.getenv("PROPHET_SEASONALITY_MODE", "additive")
|
|
|
|
|
PROPHET_DAILY_SEASONALITY: bool = os.getenv("PROPHET_DAILY_SEASONALITY", "true").lower() == "true"
|
|
|
|
|
PROPHET_WEEKLY_SEASONALITY: bool = os.getenv("PROPHET_WEEKLY_SEASONALITY", "true").lower() == "true"
|
|
|
|
|
PROPHET_YEARLY_SEASONALITY: bool = os.getenv("PROPHET_YEARLY_SEASONALITY", "true").lower() == "true"
|
|
|
|
|
|
2025-07-19 21:16:25 +02:00
|
|
|
# CORS
|
|
|
|
|
CORS_ORIGINS: str = os.getenv("CORS_ORIGINS", "http://localhost:3000,http://localhost:3001")
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def CORS_ORIGINS_LIST(self) -> List[str]:
|
|
|
|
|
"""Get CORS origins as list"""
|
|
|
|
|
return [origin.strip() for origin in self.CORS_ORIGINS.split(",")]
|
|
|
|
|
|
2025-07-17 13:09:24 +02:00
|
|
|
class Config:
|
|
|
|
|
env_file = ".env"
|
|
|
|
|
|
|
|
|
|
settings = Settings()
|