Out Plane
env

env pull

Write an application's environment variables to a file.

read onlyrepeatable--dry-run

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

ArgumentTypeDescription
FILEstringPath to the file. Defaults to .env.

Flags

FlagTypeDescription
--appstringApplication name or id. Defaults to the linked app. A flag rather than an argument, so that variable names cannot be mistaken for it.
--forceboolReplace the file if it already exists.

The global flags apply as well.

Output

FieldTypeDescription
actionstringOne of pull.
filestringThe path that was written.
appstring
appIdstring
variablesintHow many were written.
keysarrayThe names that were written, sorted. Never the values.
writtenboolFalse for a dry run.
deploymentIdint | nullAlways null here.

Examples

Write the linked application's variables to .env

outplane env pull

Write another application's to a named file

outplane env pull .env.production --app checkout

Replace a file that is already there

outplane env pull .env --force

Check 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 push returns exactly what was pulled.

Errors

Beyond 0 for success, this command exits with:

ExitKindMeaning
1internalAn unexpected failure in the CLI itself.
2usageInvalid arguments, unknown flag, or client-side validation failure.
3authNot authenticated, token revoked or expired, or forbidden for this team.
5not_foundThe named resource does not exist, or is not visible to this credential.
6conflictThe resource already exists, or a concurrent change won.
8upstreamThe 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.

On this page