Environment-based Configuration
The Doppler CLI can be configured via the environment. This allows for controlling the CLI's behavior without needing to specify flags on every command.
To disable reading configuration from the environment, specify the --no-read-env
flag.
Configuration hierarchy
CLI configuration is processed in the following manner, with lower numbers given higher priority:
- Flag
- Environment variable
- Configuration file (if supported)
Example
Given the following commands, where each command specifies a different Doppler config to use, the Doppler config used on line 3 would be bar
.
$ export DOPPLER_CONFIG=foo
$ doppler setup --project backend --config dev
$ doppler run --config=bar -- printenv
bar
is used because line 3 specifies this config with the --config
flag. Had that flag not been passed, the config used on line 3 would have been foo
due to DOPPLER_CONFIG
being specified in the environment. If DOPPLER_CONFIG
had not been specified in the environment AND the --config
flag had not been passed on line 3, then config dev
would have been used due to its existence in the CLI's configuration (from line 2).
Debugging
To see what values the CLI is currently using, run the doppler configure debug
command. This will print each configuration value, as well as the source of each value ("Flag", "Environment", "Config file", etc).
Supported variables
DOPPLER_API_HOST
: The host address of the Doppler API. This is used by Doppler developers when testing against dev and staging environments.DOPPLER_CONFIG
: The Doppler config to use.DOPPLER_CONFIG_DIR
: The location of the directory containing the CLI's configuration file and other metadata files.DOPPLER_ENABLE_DNS_RESOLVER
: Whether to bypass the OS's default DNS resolver and use the DNS resolver built-in to the CLI. When enabled, defaults to Cloudflare's DNS servers.DOPPLER_ENABLE_VERSION_CHECK
: Whether to disable checking for new versions of the Doppler CLI.DOPPLER_PASSPHRASE
: The passphrase to use for encrypting and decrypting the fallback file.DOPPLER_PROJECT
: The Doppler project to use.DOPPLER_TOKEN
: The token to use when communicating with the Doppler API.
Updated 4 months ago