修复--auth-stdin读取失败的bug

This commit is contained in:
2026-06-02 18:41:39 +08:00
parent c16e6e3d0c
commit f87dd91b2b
3 changed files with 46 additions and 4 deletions
+12 -2
View File
@@ -8,14 +8,24 @@ from .core import DEFAULT_TIMEOUT, build_runtime_context, emit_success, request_
def runtime_context(ctx: typer.Context):
obj = ctx.obj or {}
return build_runtime_context(
obj = ctx.obj
if not isinstance(obj, dict):
obj = {}
ctx.obj = obj
cached_runtime = obj.get("_runtime_context")
if cached_runtime is not None:
return cached_runtime
runtime = build_runtime_context(
server=obj.get("server"),
auth_stdin=obj.get("auth_stdin", False),
scheme=obj.get("scheme"),
timeout=obj.get("timeout", DEFAULT_TIMEOUT),
request_id=obj.get("request_id"),
)
obj["_runtime_context"] = runtime
return runtime
def emit_api(
+1 -1
View File
@@ -119,7 +119,7 @@ def load_auth_context(auth_stdin: bool = False) -> AuthContext:
project_id=_pick(raw, "project_id", "projectId", "x_project_id"),
user_id=_pick(raw, "user_id", "userId", "x_user_id"),
username=_pick(raw, "username", "preferred_username"),
network=_pick(raw, "network", "project_code", "projectCode", "project"),
network="tjwater",
headers={str(key): str(value) for key, value in headers.items()},
)