File size: 1,113 Bytes
8a08300
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
API Configuration.

Environment-based configuration using Pydantic settings.
"""

from pydantic_settings import BaseSettings
from typing import Optional


class Settings(BaseSettings):
    """
    Application settings loaded from environment variables.

    Usage:
        >>> from src.api.config import settings
        >>> print(settings.model_path)
    """

    # Model paths
    model_path: str = "models/fraud_model.pkl"
    threshold_path: str = "models/threshold.json"

    # Redis configuration
    redis_host: str = "localhost"
    redis_port: int = 6379
    redis_db: int = 0
    redis_password: Optional[str] = None

    # Feature flags
    shadow_mode: bool = False
    enable_explainability: bool = False

    # Performance
    max_latency_ms: float = 50.0

    # API metadata
    api_version: str = "1.0.0"
    api_title: str = "PayShield Fraud Detection API"

    model_config = {
        "env_file": ".env",
        "case_sensitive": False,
        "extra": "ignore",  # Ignore extra fields in .env
    }


# Global settings instance
settings = Settings()


__all__ = ["settings", "Settings"]