env get
Print one environment variable.
One variable's value, printed on its own. It stays plain text even through a pipe,
so TOKEN=$(outplane env get TOKEN) does exactly what it looks like, and a failure
leaves standard output empty rather than putting an error message into the
variable.
--hangar <name> reads from a Hangar instead of an application.
Usage
outplane env get <KEY> [flags]Arguments
| Argument | Type | Description |
|---|---|---|
KEY | string | The variable's name. Required. |
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. |
The global flags apply as well.
Output
| Field | Type | Description |
|---|---|---|
key | string | |
value | string | Never masked: asking for one value is the request to see it. |
This command prints a bare value in every format, so it can be read straight into a variable. It has no JSON form.
Examples
Read one value
outplane env get DATABASE_URL --app checkoutCapture it in a shell variable
DATABASE_URL=$(outplane env get DATABASE_URL)Read the key and value as an object
outplane env get DATABASE_URL --json{
"key": "DATABASE_URL",
"value": "postgresql://…"
}Read one value from a Hangar
outplane env get LOG_LEVEL --hangar myhangarWhat to Know
- Text is the default even in a pipe, unlike every other command. stdout carries the raw value and a newline and nothing else, so KEY=$(outplane env get KEY) works in a script. Pass --json to get an object instead.
- Because the piped default is text, a failure is a sentence on stderr rather than a JSON envelope on stdout, and stdout stays empty. That is what keeps command substitution from capturing an error message. Pass --json when the envelope is wanted.
- A missing variable is exit 5 with env.not_found and the available keys in the error's details, so a caller never has to list separately to find out what it should have asked for.
- --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.
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.