env unset
Remove environment variables.
Removes variables by name.
All of them or none of them: a name that is not set stops the whole command, so a typo cannot half remove something. The value itself cannot be recovered afterwards.
--hangar <name> removes them from a Hangar instead, and --restart restarts it so the
removal applies now.
Usage
outplane env unset <KEY...> [flags]Arguments
| Argument | Type | Description |
|---|---|---|
KEY | string | The variable's name, 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. |
--hangar | string | A Hangar's name or id, instead of an application. Not with --app. |
--deploy | bool | Deploy afterwards, so the removal reaches the running app. Not with --hangar. |
--restart | bool | With --hangar: restart the Hangar afterwards, so the change reaches it now. Stops everything running in its terminal. Restarts nothing on a paused Hangar. |
The global flags apply as well.
Output
| Field | Type | Description |
|---|---|---|
action | string | One of set, unset. |
keys | array | The names that were removed. |
app | string | |
changed | bool | False for a dry run. |
deploymentId | int | null | |
restarted | bool | null | Whether --restart restarted the Hangar. false without it, on a paused Hangar, for a dry run and when the restart was refused. null when the target is an application. |
Examples
Remove one variable
outplane env unset LOG_LEVELRemove several and apply the change
outplane env unset LOG_LEVEL TIMEOUT --app checkout --deployCheck the names resolve before removing anything
outplane env unset LOG_LEVEL --dry-run --json{
"changed": false,
"keys": [
"LOG_LEVEL"
]
}Remove several at once and read the result
outplane env unset LOG_LEVEL TIMEOUT --json --fields keys,changedRemove one from a Hangar and restart it to apply the change
outplane env unset LOG_LEVEL --hangar myhangar --restartWhat to Know
- A name that is not set is exit 5 and nothing is removed, including the names that were valid. Removal is all or nothing.
- The value cannot be recovered afterwards. This command is not gated behind a confirmation, because removing a variable is an ordinary edit; the irreversible part is the value, not the application.
- Without --deploy the running application still has the variable. Removing it from the record and from the process are two different things.
- --hangar names a Hangar instead of an application, and is refused together with --app. A Hangar is an application record with the same id, so the requests are the same, and a result's app field holds the Hangar's name.
- Saving changes nothing running in a Hangar either. It is started from its saved variables, groups and ports, so without --restart a change applies at its next
outplane hangar restart, or atoutplane hangar resumewhen it is paused. --restart is refused without --hangar, and --deploy with it. - --restart stops everything running in the Hangar's terminal, agents included, and disconnects anyone connected; files under /home/hangar stay. An agent working inside the Hangar ends its own session by passing it. On a paused Hangar it restarts nothing and does not fail, and a restart the server refuses still exits 0 once the change is saved, with restarted false and the reason on stderr.
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 env.not_found, context.no_app, app.not_found, usage.missing_argument, hangar.not_found, hangar.ambiguous, usage.conflicting_flags, usage.empty_argument. Branch on that, or on the exit status. The message is prose and changes.