env
env get
Print one environment variable.
read onlyrepeatable
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.
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. |
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://…"
}What 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.
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. Branch on that, or on the exit status. The message is prose and changes.