"""Runtime configuration constants.""" import os import subprocess from pathlib import Path MODEL: str = os.environ.get("MODEL", "bedrock:global.anthropic.claude-sonnet-4-6") # Bedrock-specific credentials — isolated from the default AWS credential chain # so destroy skill scripts can continue to use the default profile for S3 access. # Use BEDROCK_AWS_PROFILE (named profile) OR the AKSK pair, not both. BEDROCK_AWS_PROFILE: str | None = os.environ.get("BEDROCK_AWS_PROFILE") BEDROCK_AWS_ACCESS_KEY_ID: str | None = os.environ.get("BEDROCK_AWS_ACCESS_KEY_ID") BEDROCK_AWS_SECRET_ACCESS_KEY: str | None = os.environ.get( "BEDROCK_AWS_SECRET_ACCESS_KEY" ) BEDROCK_AWS_SESSION_TOKEN: str | None = os.environ.get("BEDROCK_AWS_SESSION_TOKEN") BEDROCK_AWS_REGION: str = os.environ.get("BEDROCK_AWS_REGION", "us-east-1") # Hardcoded for safety — never allow the model to target a different repo or ref. REPO: str = "tidbcloud/auto-deploy" REF: str = "main" # Secondary repo monitored for ArgoCD delivery failures. APP_DELIVERY_REPO: str = "tidbcloud/app-delivery" # O11Y CD repo — required for BYOC deployments. OBSERVABILITY_REPO: str = "tidbcloud/observability" # Local checkouts of sibling repositories, resolved relative to this file so # the paths are correct regardless of the working directory at runtime. # Layout: /auto-deploy/autopilot/config.py → /app-delivery/ _SIBLINGS_DIR: Path = Path(__file__).parent.parent.parent.resolve() AUTO_DEPLOY_DIR: Path = _SIBLINGS_DIR / "auto-deploy" APP_DELIVERY_DIR: Path = _SIBLINGS_DIR / "app-delivery" OBSERVABILITY_DIR: Path = _SIBLINGS_DIR / "observability" def _get_github_login() -> str: # Allow override via env var so evals and tests can skip the gh call. if login := os.environ.get("GITHUB_LOGIN"): return login try: result = subprocess.run( ["gh", "api", "user", "--jq", ".login"], capture_output=True, text=True, check=True, ) return result.stdout.strip() except Exception: return "autopilot[bot]" GITHUB_LOGIN: str = _get_github_login()