Skip to content

feat(client/cli): reusable client configuration#1496

Merged
tkircsi merged 6 commits into
mainfrom
feat/reusable-config-dirctl
May 13, 2026
Merged

feat(client/cli): reusable client configuration#1496
tkircsi merged 6 commits into
mainfrom
feat/reusable-config-dirctl

Conversation

@tkircsi
Copy link
Copy Markdown
Contributor

@tkircsi tkircsi commented May 12, 2026

Closes #1158

Context CLI Summary

This PR adds a dirctl context command group for inspecting and switching reusable client configuration profiles:

  • dirctl context list lists configured contexts and marks the persisted current_context.
  • dirctl context current prints the persisted current context, with --quiet and --json variants for prompt/status integrations.
  • dirctl context set <name> persists a configured context as the active default.
  • dirctl context show [name] displays the effective resolved client configuration with sensitive values redacted.
  • dirctl context validate [name] validates one or all configured contexts and reports actionable errors.

Contexts are selected by --context, DIRECTORY_CLIENT_CONTEXT, or the persisted current_context, and are resolved through the shared client config package for CLI and SDK reuse.

Default Config Path

The default client config path is:

$XDG_CONFIG_HOME/dirctl/config.yaml

If XDG_CONFIG_HOME is not set, the path falls back to:

~/.config/dirctl/config.yaml

Config Schema

The config file contains a persisted current context and a map of named contexts:

current_context: <context-name>
contexts:
  <context-name>:
    server_address: <host:port>
    auth_mode: <insecure|none|jwt|x509|token|tls|oidc>
    spiffe_socket_path: <path>
    spiffe_token: <token>
    jwt_audience: <audience>
    tls_skip_verify: <true|false>
    tls_ca_file: <path>
    tls_cert_file: <path>
    tls_key_file: <path>
    oidc_issuer: <issuer-url>
    oidc_client_id: <client-id>
    auth_token: <bearer-token>

Only fields required for the selected auth mode need to be set. Sensitive values such as auth_token and spiffe_token are redacted by dirctl context show.

Example Config

current_context: dev
contexts:
  dev:
    server_address: dev.gateway.example.com:443
    auth_mode: oidc
    oidc_issuer: https://dev.idp.example.com
    oidc_client_id: dirctl

  prod:
    server_address: prod.gateway.example.com:443
    auth_mode: oidc
    oidc_issuer: https://prod.idp.example.com
    oidc_client_id: dirctl

  daemon:
    server_address: localhost:8888
    auth_mode: insecure

tkircsi added 5 commits May 12, 2026 10:43
Signed-off-by: Tibor Kircsi <tkircsi@cisco.com>
Signed-off-by: Tibor Kircsi <tkircsi@cisco.com>
Signed-off-by: Tibor Kircsi <tkircsi@cisco.com>
Signed-off-by: Tibor Kircsi <tkircsi@cisco.com>
Signed-off-by: Tibor Kircsi <tkircsi@cisco.com>
@tkircsi tkircsi self-assigned this May 12, 2026
@tkircsi tkircsi requested a review from a team as a code owner May 12, 2026 13:15
@tkircsi tkircsi added kind/feature Categorizes issue or PR as related to a new feature. area/cli area/dir/client labels May 12, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Discovery May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped⏩ skipped✅ passedMay 12, 2026, 3:08 PM

@github-actions github-actions Bot added the size/XL Denotes a PR that changes 2000+ lines label May 12, 2026
@tkircsi tkircsi moved this from Backlog to In Progress in Discovery May 12, 2026
@tkircsi tkircsi moved this from In Progress to Pending review in Discovery May 12, 2026
Copy link
Copy Markdown
Member

@arpad-csepi arpad-csepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might worth to add a flag for disable redact if the user want to see the sensitive data as well in the dirctl context show

@tkircsi tkircsi merged commit 24c8119 into main May 13, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from Pending review to Done in Discovery May 13, 2026
@tkircsi tkircsi deleted the feat/reusable-config-dirctl branch May 13, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli area/dir/client kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 2000+ lines

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Epic] Reusable client configuration

2 participants