Out Plane
env

env set

Set environment variables.

writesrepeatable--dry-run

Adds variables, or replaces the ones that already exist. Only the keys you name are touched, so nothing you did not mention can be lost.

Saving is not deploying. Without --deploy the running application keeps the values it started with, and this is the easiest thing here to get wrong.

Usage

outplane env set <ASSIGNMENT...> [flags]

Arguments

ArgumentTypeDescription
ASSIGNMENTstringKEY=VALUE, repeatable. Required. Takes the rest of the line.

Flags

FlagTypeDescription
--appstringApplication name or id. Defaults to the linked app. A flag rather than an argument, so that variable names cannot be mistaken for it.
--deployboolDeploy afterwards, so the change reaches the running app.

The global flags apply as well.

Output

FieldTypeDescription
actionstringOne of set, unset.
keysarrayThe names that were written, sorted.
appstring
changedboolFalse for a dry run.
deploymentIdint | nullThe deployment --deploy started, or null when it was not given.

Examples

Set one variable on the linked app

outplane env set LOG_LEVEL=debug

Set several and apply them at once

outplane env set LOG_LEVEL=debug TIMEOUT=30 --app checkout --deploy

See what would happen

outplane env set LOG_LEVEL=debug --dry-run

Give an application a managed database's connection string

outplane env set DATABASE_URL="$(outplane db url orders)" --app checkout --deploy

Set one and read what changed

outplane env set LOG_LEVEL=debug --json --fields keys,changed
{
  "changed": true,
  "keys": [
    "LOG_LEVEL"
  ]
}

What to Know

  • Saving does not restart anything. Without --deploy the running application keeps the values it started with, which is the single easiest thing to get wrong here.
  • Only the named keys are changed. This command never sends the whole set, so it cannot drop a variable it was not told about.
  • A value may contain an equals sign: only the first one separates the key, so KEY=a=b sets KEY to a=b.
  • HOSTNAME and any key starting with OP_ or KUBERNETES_ are refused. PORT is not reserved and may be set.
  • Setting an existing key replaces it, so running this twice with the same arguments leaves the same state.
  • deploymentId is null unless --deploy was given. A queued deployment is not a finished one; follow it with outplane deploy logs.

Errors

Beyond 0 for success, this command exits with:

ExitKindMeaning
2usageInvalid arguments, unknown flag, or client-side validation failure.
3authNot authenticated, token revoked or expired, or forbidden for this team.
5not_foundThe named resource does not exist, or is not visible to this credential.
8upstreamThe Out Plane API returned a server error.

The code on the error object is one of usage.bad_assignment, usage.duplicate_key, env.reserved_key, env.reserved_prefix, env.key_too_long, env.value_too_long, env.too_many, context.no_app, app.not_found. Branch on that, or on the exit status. The message is prose and changes.

On this page