env set
Set environment variables.
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
| Argument | Type | Description |
|---|---|---|
ASSIGNMENT | string | KEY=VALUE, repeatable. Required. Takes the rest of the line. |
Flags
| Flag | Type | Description |
|---|---|---|
--app | string | Application name or id. Defaults to the linked app. A flag rather than an argument, so that variable names cannot be mistaken for it. |
--deploy | bool | Deploy afterwards, so the change reaches the running app. |
The global flags apply as well.
Output
| Field | Type | Description |
|---|---|---|
action | string | One of set, unset. |
keys | array | The names that were written, sorted. |
app | string | |
changed | bool | False for a dry run. |
deploymentId | int | null | The deployment --deploy started, or null when it was not given. |
Examples
Set one variable on the linked app
outplane env set LOG_LEVEL=debugSet several and apply them at once
outplane env set LOG_LEVEL=debug TIMEOUT=30 --app checkout --deploySee what would happen
outplane env set LOG_LEVEL=debug --dry-runGive an application a managed database's connection string
outplane env set DATABASE_URL="$(outplane db url orders)" --app checkout --deploySet 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:
| Exit | Kind | Meaning |
|---|---|---|
2 | usage | Invalid arguments, unknown flag, or client-side validation failure. |
3 | auth | Not authenticated, token revoked or expired, or forbidden for this team. |
5 | not_found | The named resource does not exist, or is not visible to this credential. |
8 | upstream | The 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.