| 1 | from functools import lru_cache |
| 2 | from pydantic_settings import BaseSettings, SettingsConfigDict |
| 3 | |
| 4 | |
| 5 | class Settings(BaseSettings): |
| 6 | model_config = SettingsConfigDict(env_prefix="SIGHTLINE_", env_file=".env", extra="ignore") |
| 7 | |
| 8 | app_name: str = "Sightline ALPR Intelligence" |
| 9 | environment: str = "dev" |
| 10 | secret_key: str = "dev-insecure-change-me" |
| 11 | access_token_expire_minutes: int = 60 * 12 |
| 12 | jwt_algorithm: str = "HS256" |
| 13 | |
| 14 | database_url: str = "postgresql+psycopg2://sightline:sightline@localhost:5432/sightline" |
| 15 | redis_url: str = "redis://localhost:6379/0" |
| 16 | |
| 17 | storage_dir: str = "./_storage" |
| 18 | storage_backend: str = "local" |
| 19 | s3_bucket: str = "sightline" |
| 20 | s3_endpoint_url: str | None = None |
| 21 | s3_region: str | None = None |
| 22 | cors_origins: list[str] = ["http://localhost:3000"] |
| 23 | |
| 24 | oidc_enabled: bool = False |
| 25 | oidc_issuer: str | None = None |
| 26 | oidc_client_id: str | None = None |
| 27 | oidc_client_secret: str | None = None |
| 28 | oidc_redirect_uri: str = "http://localhost:8000/api/v1/auth/oidc/callback" |
| 29 | oidc_default_role: str = "analyst" |
| 30 | |
| 31 | max_upload_bytes: int = 50 * 1024 * 1024 |
| 32 | |
| 33 | dedup_window_seconds: int = 1 |
| 34 | impossible_speed_kmh: float = 250.0 |
| 35 | cotravel_window_seconds: int = 120 |
| 36 | dwell_gap_seconds: int = 1800 |
| 37 | |
| 38 | default_retention_days: int = 365 |
| 39 | rate_limit_per_minute: int = 600 |
| 40 | |
| 41 | open_mode: bool = True |
| 42 | |
| 43 | |
| 44 | @lru_cache |
| 45 | def get_settings() -> Settings: |
| 46 | return Settings() |
| 47 | |
| 48 | |
| 49 | settings = get_settings() |