- Fix 20 ruff errors: UP035 (Callable import), UP042 (StrEnum), E501 (line length), F401 (unused imports), UP045 (Optional -> X | None), I001 (import sorting) - Fix mypy error: wrap slowapi rate limit handler with Exception-compatible signature for add_exception_handler - Pin pip >= 25.3 in Dockerfile (CVE-2025-8869, CVE-2026-1703) - Add nosec B104 to config.py (container-bound 0.0.0.0 is acceptable) - Add nosec B101 to telemetry.py (assert for type narrowing) - Create bandit.yaml to suppress B404/B607/B603 in gates/ tooling Fixes #365 Co-Authored-By: Claude Opus 4.6 <[email protected]>
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
"""Configuration management for mosaic-coordinator."""
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
case_sensitive=False,
|
|
extra="ignore",
|
|
)
|
|
|
|
# Gitea Configuration
|
|
gitea_webhook_secret: str
|
|
gitea_url: str = "https://git.mosaicstack.dev"
|
|
|
|
# Anthropic API
|
|
anthropic_api_key: str
|
|
|
|
# Server Configuration
|
|
host: str = "0.0.0.0" # nosec B104 — Container-bound: listen on all interfaces inside Docker
|
|
port: int = 8000
|
|
|
|
# Logging
|
|
log_level: str = "info"
|
|
|
|
# Coordinator Configuration
|
|
coordinator_poll_interval: float = 5.0
|
|
coordinator_max_concurrent_agents: int = 10
|
|
coordinator_enabled: bool = True
|
|
|
|
|
|
def get_settings() -> Settings:
|
|
"""Get settings instance (lazy loaded)."""
|
|
return Settings() # type: ignore[call-arg]
|
|
|
|
|
|
# Global settings instance
|
|
settings = get_settings()
|