@@ -52,6 +52,49 @@ The `login` command enters interactive wizard mode when `--client-id` or `--clie
5252
5353` use ` and ` show ` are always non-interactive.
5454
55+ ## Credential Resolution Order
56+
57+ Authentication credentials are resolved from multiple sources. The table below
58+ shows the order of precedence (highest first):
59+
60+ | Priority | Source | Example |
61+ | ----------| --------| ---------|
62+ | 1 | CLI flags | ` --auth.client-id=xxx --auth.client-secret=yyy ` |
63+ | 2 | Config file (viper) | ` auth.client-id ` in ` ~/.verda/config.yaml ` |
64+ | 3 | Environment variables | ` VERDA_CLIENT_ID ` , ` VERDA_CLIENT_SECRET ` |
65+ | 4 | Credentials file profile | ` [default] ` section in ` ~/.verda/credentials ` |
66+
67+ ### Supported Environment Variables
68+
69+ | Variable | Description |
70+ | ----------| -------------|
71+ | ` VERDA_CLIENT_ID ` | API client ID |
72+ | ` VERDA_CLIENT_SECRET ` | API client secret |
73+ | ` VERDA_PROFILE ` | Credentials profile name |
74+ | ` VERDA_SHARED_CREDENTIALS_FILE ` | Path to credentials file |
75+ | ` VERDA_AGENT ` | Enable agent mode (` 1 ` or ` true ` ) |
76+ | ` VERDA_HOME ` | Base directory for config (default ` ~/.verda ` ) |
77+
78+ ### Explicit Profile Override
79+
80+ When ` --auth.profile ` is passed explicitly, the credentials file values for that
81+ profile override env vars and config file values — but CLI flags still win.
82+
83+ For example:
84+
85+ ``` bash
86+ # Env var is set
87+ export VERDA_CLIENT_ID=env-id
88+
89+ # Explicit profile overrides the env var
90+ verda compute list --auth.profile=staging
91+ # → uses client ID from [staging] in ~/.verda/credentials, not env-id
92+
93+ # But a CLI flag always wins
94+ verda compute list --auth.profile=staging --auth.client-id=flag-id
95+ # → uses flag-id
96+ ```
97+
5598## Architecture Notes
5699
57100- ** auth.go** -- Parent command registration; adds ` login ` , ` use ` , ` show ` subcommands.
0 commit comments