Skip to content

Configuration Reference

NDCLI uses a YAML configuration file and supports environment variable overrides. This reference covers all configuration options.

~/Library/Application Support/ndcli/config.yaml

Use --conf to specify a custom config file path:

Terminal window
ndcli --conf /path/to/config.yaml device list
oauth2:
provider: netdefense
domain: auth.netdefense.io
client_id: your-client-id
audience: authcli
scopes: openid profile email offline_access
controlplane:
host: https://control.netdefense.io
ssl_verify: true
organization:
name: my-organization
output:
format: detailed
auth:
storage: keyring
account: user@example.com
path: ""

Settings for OAuth2 authentication provider.

KeyTypeDefaultDescription
oauth2.providerstring(built-in)OAuth2 provider type
oauth2.domainstringauth-dev.netdefense.ioOAuth2 domain
oauth2.client_idstring(built-in)OAuth2 client ID
oauth2.audiencestringauthcliOAuth2 audience
oauth2.scopesstringopenid profile email offline_accessOAuth2 scopes

Settings for the NetDefense API connection.

KeyTypeDefaultDescription
controlplane.hoststringhttps://dev-control.netdefense.ioAPI host URL
controlplane.ssl_verifybooltrueVerify SSL certificates

To use a different API host (e.g., self-hosted or staging):

controlplane:
host: https://control.example.com
ssl_verify: true

Default organization for commands.

KeyTypeDefaultDescription
organization.namestring""Default organization name

Set via command:

Terminal window
ndcli config set org my-organization

Override per-command:

Terminal window
ndcli device list --org other-organization

Output formatting preferences.

KeyTypeDefaultDescription
output.formatstringdetailedDefault output format

Valid formats:

FormatDescription
tableTabular format, good for lists
simpleCompact bullet-point format
detailedRich Unicode box drawing
jsonMachine-readable JSON

Set via command:

Terminal window
ndcli config set output json

Override per-command:

Terminal window
ndcli device list -f table

Settings for credential storage.

KeyTypeDefaultDescription
auth.storagestringkeyringStorage backend: keyring or file
auth.accountstring""Account email for keyring lookup
auth.pathstring""Custom path for file storage

Credentials are stored in the system keyring:

  • macOS: Keychain
  • Linux: Secret Service (GNOME Keyring, KWallet)
  • Windows: Credential Manager
auth:
storage: keyring
account: user@example.com

If keyring is unavailable, credentials are stored in a file:

auth:
storage: file
path: /custom/path/auth.json

Default file locations:

  • macOS: ~/Library/Application Support/ndcli/auth.json
  • Linux: ~/.config/ndcli/auth.json
  • Windows: %APPDATA%\ndcli\auth.json

NDCLI_TOKEN is a special case, separate from the auth.storage keyring/file choice above. Set it to a Personal Access Token (PAT) — a credential with an ndpat_ prefix, minted with ndcli auth token create — and ndcli skips keyring/file lookup and interactive login entirely for that invocation:

Terminal window
export NDCLI_TOKEN=ndpat_your_token_here
ndcli device list

This is the mechanism for CI/CD pipelines, headless servers, and any script that runs without a human present to click through a browser login. See the Personal Access Tokens guide for how to create, scope, and rotate tokens, and the full precedence order below.

All configuration options can be set via environment variables with the NDCLI_ prefix:

Environment VariableConfig Key
NDCLI_OAUTH2_PROVIDERoauth2.provider
NDCLI_OAUTH2_DOMAINoauth2.domain
NDCLI_OAUTH2_CLIENT_IDoauth2.client_id
NDCLI_OAUTH2_AUDIENCEoauth2.audience
NDCLI_OAUTH2_SCOPESoauth2.scopes
NDCLI_CONTROLPLANE_HOSTcontrolplane.host
NDCLI_CONTROLPLANE_SSL_VERIFYcontrolplane.ssl_verify
NDCLI_ORGANIZATION_NAMEorganization.name
NDCLI_OUTPUT_FORMAToutput.format
NDCLI_TOKEN(no config key — auth override, see below)

NDCLI_TOKEN doesn’t map to a config.yaml key. It’s read directly at authentication time and never written to the config file or keyring, so it isn’t part of the flags → env → file → defaults precedence chain that governs the rest of this table. See Authentication precedence.

Terminal window
export NDCLI_ORGANIZATION_NAME=production
export NDCLI_OUTPUT_FORMAT=json
export NDCLI_CONTROLPLANE_HOST=https://api.example.com

Configuration values are resolved in this order (highest to lowest priority):

  1. Command-line flags (--org, -f)
  2. Environment variables (NDCLI_*)
  3. Config file (config.yaml)
  4. Built-in defaults

Authentication is resolved separately from the general config precedence above, in this order:

  1. NDCLI_TOKEN — if set and it validates as an ndpat_... token, it is used for every request and the keyring/file/interactive paths below are skipped entirely, even if a valid cached session also exists.
  2. Cached session — the tokens stored by a prior ndcli auth login (keyring or file, per auth.storage).
  3. Interactive login — if neither of the above is available, ndcli prompts you to run ndcli auth login.
controlplane:
host: https://dev-control.netdefense.io
ssl_verify: true
organization:
name: dev-environment
output:
format: detailed
auth:
storage: keyring
controlplane:
host: https://control.netdefense.io
ssl_verify: true
organization:
name: production
output:
format: json
auth:
storage: file
path: /secrets/ndcli-auth.json
controlplane:
host: https://control.netdefense.io
organization:
name: ""
output:
format: table
Terminal window
ndcli config show
Terminal window
ndcli config reset

Open the config file directly:

Terminal window
$EDITOR ~/.config/ndcli/config.yaml
code ~/Library/Application\ Support/ndcli/config.yaml