35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Configuration via environment variables."""
|
|
|
|
import os
|
|
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass
|
|
class Config:
|
|
nexus_url: str = os.getenv("NEXUS_URL", "http://localhost:8081")
|
|
nexus_username: str = os.getenv("NEXUS_USERNAME", "admin")
|
|
nexus_password: str = os.getenv("NEXUS_PASSWORD", "admin123")
|
|
nexus_repositories: list[str] = field(default_factory=lambda: _parse_repos())
|
|
|
|
database_path: str = os.getenv("DATABASE_PATH", "data/guarddog.db")
|
|
|
|
host: str = os.getenv("HOST", "0.0.0.0")
|
|
port: int = int(os.getenv("PORT", "8080"))
|
|
|
|
log_level: str = os.getenv("LOG_LEVEL", "INFO")
|
|
log_syslog_host: str = os.getenv("LOG_SYSLOG_HOST", "")
|
|
log_syslog_port: int = int(os.getenv("LOG_SYSLOG_PORT", "514"))
|
|
|
|
webhook_secret: str = os.getenv("WEBHOOK_SECRET", "")
|
|
|
|
scan_timeout_seconds: int = int(os.getenv("SCAN_TIMEOUT_SECONDS", "300"))
|
|
temp_dir: str = os.getenv("TEMP_DIR", "/tmp/guarddog-nexus")
|
|
|
|
|
|
def _parse_repos() -> list[str]:
|
|
raw = os.getenv("NEXUS_REPOSITORIES", "")
|
|
return [r.strip() for r in raw.split(",") if r.strip()]
|
|
|
|
|
|
config = Config()
|