Skip to main content

tcb fn env pull

Export the environment variables of a deployed function to a local file.

Prerequisites​

  • tcb login has been completed and the function is deployed.
  • The output file path is known. --output-file is required.

Usage​

tcb fn env pull <name> --output-file <file> [options]

Flags​

FlagRequiredDescriptionDefault
<name>YesFunction name—
--output-file <file>YesOutput file path, such as .env.local—
-e, --env-id <envId>NoEnvironment IDSelected interactively when omitted
--jsonNoOutput the result as JSON—

Examples​

# Export to .env
tcb fn env pull app --output-file .env

# Export to .env.local with an explicit environment
tcb fn env pull app --output-file .env.local --env-id env-xxxx

# Export to a specific directory and print the result as JSON
tcb fn env pull app --output-file ./configs/dev.env --json

Response​

The exported file uses KEY=value format, with newlines and double quotes escaped automatically. With --json, the output includes the function name, environment ID, output file path, variable count, and variable names.

  • tcb fn detail: show function configuration and environment variables
  • tcb fn deploy: overwrite cloud values with environment variables from the configuration file