env pull
Write an application's environment variables to a file.
Writes the application's variables to a file in .env format, quoting whatever
needs quoting. The values go into the file and never into this command's own output.
A file that already exists stops the command rather than being overwritten. Pull and push are a matched pair: what comes out reads back in unchanged.
Usage
outplane env pull [FILE] [flags]Arguments
| Argument | Type | Description |
|---|---|---|
FILE | string | Path to the file. Defaults to .env. |
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. |
--force | bool | Replace the file if it already exists. |
The global flags apply as well.
Output
| Field | Type | Description |
|---|---|---|
action | string | One of pull. |
file | string | The path that was written. |
app | string | |
appId | string | |
variables | int | How many were written. |
keys | array | The names that were written, sorted. Never the values. |
written | bool | False for a dry run. |
deploymentId | int | null | Always null here. |
Examples
Write the linked application's variables to .env
outplane env pullWrite another application's to a named file
outplane env pull .env.production --app checkoutReplace a file that is already there
outplane env pull .env --forceCheck what would be written, and where
outplane env pull --dry-run --json{
"action": "pull",
"app": "checkout",
"file": ".env",
"variables": 12,
"written": false
}What to Know
- Values are written to the file and never to this command's own output. keys lists the names; there is no flag that adds the values to the result.
- The file is created with owner-only permissions, replacing it atomically, so a failure part way through leaves the previous file intact rather than half of a new one.
- An existing file is a refusal, exit 6 with env.file_exists, not a silent overwrite. --force replaces it.
- Variables from an assigned group are not included, so a pulled file can hold fewer variables than the running application has. What is missing is reported on stderr and read with
outplane env group get. - Values are written in .env format, which means a value containing a newline, a quote or a leading space comes back quoted. Reading it with
env pushreturns exactly what was pulled.
Errors
Beyond 0 for success, this command exits with:
| Exit | Kind | Meaning |
|---|---|---|
1 | internal | An unexpected failure in the CLI itself. |
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. |
6 | conflict | The resource already exists, or a concurrent change won. |
8 | upstream | The Out Plane API returned a server error. |
The code on the error object is one of env.file_exists, env.file_unwritable, env.file_unreadable, env.file_invalid, context.no_app, app.not_found. Branch on that, or on the exit status. The message is prose and changes.