feat: add credential encryption key config and improve service token CLI display

- Add CREDENTIAL_ENCRYPTION_KEY environment variable with Fernet key generation guide
- Improve service token issue command to display raw token once with warning
- Refactor token list display function for better UX (new print_service_token_list)
- Keep backward compatibility with print_service_token_table alias
This commit is contained in:
2026-05-02 12:25:25 +00:00
parent c31ca50bdd
commit 8370d998d2
3 changed files with 38 additions and 23 deletions
+8 -3
View File
@@ -81,10 +81,15 @@ def issue_service_token(
runtime_id=issued.auth_token.runtime_id,
token=issued.token,
)
render_service_token_result(ctx.obj.console, ctx.obj.output_format, response)
if ctx.obj.output_format != "json":
ctx.obj.console.print(f"masked_token: {mask_token_text(issued.token)}")
# 발급 시 1회에 한해 원문 token 출력 (이후 마스킹된 값만 표시됨)
if ctx.obj.output_format == "json":
from app.cli.core.utils import render_output
render_output(ctx.obj.console, "json", response.model_dump(mode="json"))
else:
ctx.obj.console.print("[bold yellow]⚠ 토큰 원문은 지금 1회만 표시됩니다. 안전한 곳에 저장하세요.[/bold yellow]")
ctx.obj.console.print(f"[bold green]token:[/bold green] {issued.token}")
render_service_token_result(ctx.obj.console, ctx.obj.output_format, response)
@token_app.command("revoke")