tcb fn env pull
Export the environment variables of a deployed function to a local file.
Prerequisites
tcb loginhas been completed and the function is deployed.- The output file path is known.
--output-fileis required.
Usage
tcb fn env pull <name> --output-file <file> [options]
Flags
| Flag | Required | Description | Default |
|---|---|---|---|
<name> | Yes | Function name | — |
--output-file <file> | Yes | Output file path, such as .env.local | — |
-e, --env-id <envId> | No | Environment ID | Selected interactively when omitted |
--json | No | Output 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.
Related commands
tcb fn detail: show function configuration and environment variablestcb fn deploy: overwrite cloud values with environment variables from the configuration file