Build a config, applying explicit > env > default precedence. Relay token sources: ``CMDOP_TOKEN`` then ``CMDOP_API_KEY`` (token wins if both) — keeps single-credential setups working. The skills plane reads ``api_key`` from ``CMDOP_API_KEY`` independently.
(
cls,
*,
token: str | None = None,
base_url: str | None = None,
fleet_id: str | None = None,
timeout_ms: int | None = None,
api_key: str | None = None,
api_base_url: str | None = None,
)
| 34 | if resolved_timeout is None: |
| 35 | value = os.environ.get("CMDOP_TIMEOUT_MS") |
| 36 | resolved_timeout = int(value) if value else DEFAULT_TIMEOUT_MS |
| 37 | if resolved_timeout <= 0: |
| 38 | raise ValueError("timeout_ms must be greater than zero") |
| 39 | resolved_base = base_url or os.environ.get("CMDOP_BASE_URL") or None |
| 40 | return cls( |
| 41 | token=token or os.environ.get("CMDOP_TOKEN") or None, |
| 42 | base_url=resolved_base.rstrip("/") if resolved_base else None, |
| 43 | timeout_ms=resolved_timeout, |
| 44 | ) |