修复--auth-stdin读取失败的bug
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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()},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user