Browse documentation

CLI configuration

The wardkey CLI is configured three ways. They compose in this order, highest precedence first:

  1. 1
    1. Command-line flags
    2. Environment variables
    3. The per-user config file at ~/.config/wardkey/config.toml

Anything you pass on the CLI always wins. Anything you export as an env var wins over the file. Anything in the file is a default the others can override.

Global flags

Available on every command:

FlagDefaultMeaning
--api stringhttps://api.wardkey.appWardkey API base URL. Point at a local API Worker for development.
--org stringfrom config fileTarget org id. Overrides the org key in config.toml.
--project stringdefaultTarget project slug. Every new org has a default project at bootstrap.
--env stringproductionTarget environment slug. The default project ships with a production environment at bootstrap.
--jsonoffEmit JSON-shaped output instead of human-readable text. Useful in scripts.
-h, --help—Help for the command.
-v, --version—Print the CLI version and exit.

Environment variables

VarPurpose
WARDKEY_APIOverride the API base URL. Equivalent to --api.
WARDKEY_ORGDefault org for commands. Equivalent to --org.
WARDKEY_CONFIGOverride the config file path. Default ~/.config/wardkey/config.toml.
WARDKEY_KEYRING_BACKENDForce a specific keyring backend (e.g. file on headless Linux).
WARDKEY_KEYRING_PASSPHRASEPassphrase for the file keyring backend, so it doesn't prompt.

Config file

Per-machine defaults live at ~/.config/wardkey/config.toml (or $XDG_CONFIG_HOME/wardkey/config.toml). Override the location with WARDKEY_CONFIG. Both keys are optional:

api = "https://api.wardkey.app"
org = "org_abc"

This is the right place to pin a default org so you don't have to pass --org on every command.

Pointing at a local API

For development against a local API Worker:

# One-off
wardkey login --api http://localhost:8787

# Or persist it in the config file
cat > ~/.config/wardkey/config.toml <<'EOF'
api = "http://localhost:8787"
EOF

# Or in the env
export WARDKEY_API=http://localhost:8787

Once --api is set (any of the three ways), every subsequent command — including whoami, secrets, and exec — routes there.

Switching projects and environments

Both --project and --env are global. The default project and production environment are bootstrapped on every new org, so the bare commands work out of the box. To target something else:

# A specific project
wardkey secrets list --project payments

# A non-production environment
wardkey secrets get db/password --env staging

# Combine
wardkey exec --project payments --env staging -- ./worker.sh

There's no config-file key for these yet — they're per-command via flag or env.