from pydantic_settings import BaseSettings from typing import Literal class Settings(BaseSettings): # Deployment mode (feature flag) deployment_mode: Literal["cloud", "air-gapped"] = "air-gapped" # Database database_url: str = "postgresql://user:password@localhost:5432/datalake" # Storage Backend (automatically set based on deployment_mode if not explicitly configured) storage_backend: Literal["s3", "minio"] = "minio" # AWS S3 aws_access_key_id: str = "" aws_secret_access_key: str = "" aws_region: str = "us-east-1" s3_bucket_name: str = "test-artifacts" # MinIO minio_endpoint: str = "localhost:9000" minio_access_key: str = "minioadmin" minio_secret_key: str = "minioadmin" minio_bucket_name: str = "test-artifacts" minio_secure: bool = False # Application api_host: str = "0.0.0.0" api_port: int = 8000 max_upload_size: int = 524288000 # 500MB class Config: env_file = ".env" case_sensitive = False def __init__(self, **kwargs): super().__init__(**kwargs) # Auto-configure storage backend based on deployment mode if not explicitly set if self.deployment_mode == "cloud" and self.storage_backend == "minio": self.storage_backend = "s3" elif self.deployment_mode == "air-gapped" and self.storage_backend == "s3": self.storage_backend = "minio" settings = Settings()