Configuration Model
kdx has two configuration layers:
| Layer | Used by | Purpose |
|---|---|---|
| CLI profiles | Most interactive commands | Store a platform URL, API key, and production-safety flag in ~/.kodexa/config.yaml |
| Sync environments | kdx sync workflows | Resolve deployment environments from sync-config.yaml, usually with API keys read from environment variables |
Browser Login
Use browser login when your environment supports CLI token exchange:| Flag | Description |
|---|---|
--profile | Profile name to save. If omitted, the CLI suggests one from the host name. |
--timeout | Seconds to wait for login. Default is 180. |
--no-browser | Print the login URL instead of opening a browser. |
--device | Use device-code login instead of a local browser callback. |
API Key Profiles
Create or update a profile:list-profiles also accepts the alias get-profiles.
Command-Line Overrides
For a single command, override the current profile:KODEXA_API_KEY. Use profiles or explicit --url and --api-key overrides. kdx sync can read environment variables through sync-config.yaml.
Sync Environment Credentials
kdx sync resolves environments from sync-config.yaml:
api_key_env for CI/CD and profile for local development when you already have a saved profile.
Production Safeguards
Profiles marked with--production trigger confirmation before mutating commands such as apply and delete.
File Locations
| File or directory | Purpose |
|---|---|
~/.kodexa/config.yaml | Saved profiles and active profile |
~/.kodexa/cache/ | Cached OpenAPI specifications and discovery metadata |
sync-config.yaml | GitOps environments, targets, branch mappings, and tag mappings |
.sync-state/ | Sync conflict state. Commit this directory with the metadata repository. |
Security Practices
- Do not commit
~/.kodexa/config.yaml. - Prefer environment-backed sync credentials in CI/CD.
- Use environment-specific API keys.
- Mark production profiles with
--production. - Rotate API keys regularly.
- Use
kdx secret setfor organization secrets so secret values do not appear in command history.
Troubleshooting
No Active Profile
Create or select a profile:Profile Not Found
List profiles and rerun the command with an existing name:Resource Cache Is Stale
Refresh discovery:Sync Cannot Resolve An Environment
Check that the environment is declared insync-config.yaml and that its API key environment variable is set:
