Skip to content

qc env vars

Manage the environment variables of one Quant Cloud environment. The qc env vars commands need @quantcdn/quant-cloud-cli 0.7.0 or later. To upgrade, run npm install -g @quantcdn/quant-cloud-cli.

Command Description
qc env vars list List the variables of an environment. Values are hidden unless you pass --show-values.
qc env vars get Print the value of one variable.
qc env vars set Set one variable, or every variable in a .env file.
qc env vars unset Remove a variable.

Every subcommand takes the context flags:

Flag Description
--org <org> Organization machine name. Overrides .quant.yml and the active organization.
--app <app> Application machine name. Overrides .quant.yml and the active application.
--env <env> Environment name. Overrides .quant.yml and the active environment.

If no organization, application or environment can be found, the command stops with a message such as No environment specified. Use --env or set active environment.

These commands manage plain environment variables. Store passwords and keys as secrets in the dashboard (Environment & Secrets).


List the variables of an environment, sorted by name.

Terminal window
qc env vars list [--json] [--show-values] [--org <org>] [--app <app>] [--env <env>]
Flag Description
--json Print the variables as a JSON array of { "name", "value" } objects.
--show-values Print the values. Without this flag every value shows as ********, so a list in a CI log does not expose values.
Terminal window
qc env vars list --env staging
qc env vars list --env staging --json --show-values

Print the value of one variable, and nothing else. Use it in scripts:

Terminal window
DEBUG_VALUE="$(qc env vars get APP_DEBUG --env staging)"
Terminal window
qc env vars get <key> [--org <org>] [--app <app>] [--env <env>]

If the variable is not set, the command prints Variable '<key>' is not set on <org>/<app>/<env>. and exits with status 1. On a terminal, control characters are removed from the value before it is printed.


Set one variable, or every variable in a .env file.

Terminal window
qc env vars set <key> <value> [--org <org>] [--app <app>] [--env <env>]
qc env vars set <key> --stdin [--org <org>] [--app <app>] [--env <env>]
qc env vars set --file <path> [--org <org>] [--app <app>] [--env <env>]
Flag Description
--stdin Read the value from standard input. The value is then not in the process arguments or the shell history. One trailing newline is removed.
--file <path> Set each variable in a .env file. Variables that are not in the file are kept.
  • A variable name starts with a letter or _, followed by letters, digits, _, . or -.
  • A value cannot be empty. To remove a variable, use qc env vars unset.
  • Give a value as an argument or with --stdin, not both. --file cannot be combined with a key, a value or --stdin.
  • --file reads KEY=VALUE lines (an optional export prefix, quoted values and # comments are allowed). The command refuses the whole file, before any change, if a line is not a KEY=VALUE line, uses the KEY: VALUE form, has an invalid name or an unclosed quote, or repeats a key.
  • Each variable is saved on its own. If some variables fail, the others are still saved, the command lists the failures and exits with status 1.
Terminal window
# One plain value
qc env vars set APP_DEBUG false --env staging
# A value from a CI variable, kept off the command line
printf '%s' "$API_TOKEN" | qc env vars set API_TOKEN --stdin --env production
# Every variable in a file
qc env vars set --file .env.production --env production
# Apply the changes
qc env state redeploy --env production

Remove a variable.

Terminal window
qc env vars unset <key> [-y] [--org <org>] [--app <app>] [--env <env>]
Flag Description
-y, --yes Do not ask for confirmation.

On a terminal, the command asks before it removes the variable. In scripts and CI (no terminal) it does not ask. If the variable is not set, the command says so and changes nothing.


Message Cause
Not authenticated. Run qc login to authenticate. No login for the active platform.
Authentication expired. Run qc login to re-authenticate. HTTP 401.
Access denied. Changing variables needs the write_environments permission. HTTP 403.
Environment not found. Check --org, --app and --env. HTTP 404.
qc env vars is not a command The CLI is older than 0.7.0. Upgrade it.