env Commands

Commands to manage your environments, such as orgs and compute environments.

env compute collaborator add

Add a Heroku user as a collaborator on this Functions account, allowing them to attach Heroku add-ons to compute environments.

Examples for env compute collaborator add

Add a Heroku user as a collaborator on this Functions account.

Usage

sf env compute collaborator add
[--json]
-h HEROKU-USER

Flags

--json
Optional

Format output as json.

Type: boolean
-h | --heroku-user HEROKU-USER
Required

Email address of the Heroku user you're adding as a collaborator.

Type: option

env create compute

Create a compute environment for use with Salesforce Functions.

Description for env create compute

Compute environments must be connected to a Salesforce org. By default the command uses your local environment's connected org. Use the '--connected-org' flag to specify a specific org. Run 'sf env list' to see a list of environments.

Examples for env create compute

Create a compute environment to run Salesforce Functions:

Connect the environment to a specific org:

Create an alias for the compute environment:

Usage

sf env create compute
[--json]
[-o CONNECTED-ORG]
[-a ALIAS]

Flags

--json
Optional

Format output as json.

Type: boolean
-o | --connected-org CONNECTED-ORG
Optional

Username or alias for the org that the compute environment should be connected to.

Type: option
-a | --alias ALIAS
Optional

Alias for the created environment.

Type: option

env delete

Delete an environment.

Description for env delete

You must include the name of the environment to delete using '--target-compute'. Run 'sf env list' to see a list of environments.

Running this command will prompt a confirmation. If you want to skip this confirmation, use the '--confirm' flag and the environment alias to skip confirmation.

Examples for env delete

Delete a compute environment:

Delete without a confirmation step:

Usage

sf env delete
[--json]
[-e TARGET-COMPUTE]
[--confirm CONFIRM]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Environment name.

Type: option
--confirm CONFIRM
Optional

Confirmation name.

Type: option

env display

Display details about an environment.

Description for env display

Specify an environment with either the username you used when you logged into the environment with "sf login", or the alias you gave the environment when you created it. Run "sf env list" to view all your environments and their aliases.

Output depends on the type of environment.

Examples for env display

Display details about the "myEnv" environment:

<%- config.bin %> <%- command.id %> --target-env myEnv

Usage

sf env display
[--json]
[-e TARGET-ENV]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-env TARGET-ENV
Optional

Environment alias or login user.

Type: option

env list

List the environments you’ve created or logged into.

Description for env list

By default, the command displays active environments.

Output is displayed in multiple tables, one for each environment type.

The compute environment table shows the alias, information about the connected orgs, the project name, and more.

Use the table manipulation flags, such as --filter and --sort, to change how the data is displayed.

Run "sf env display" to view details about a specific environment.

Examples for env list

List all active environments:

List both active and inactive environments:

Don't truncate the displayed output and instead wrap text that's wider than your terminal:

Display only the table data, not the headers, in comma-separated value (csv) format:

Usage

sf env list
[--json]
[-a]
[--columns COLUMNS]
[--csv]
[--filter FILTER]
[--no-header]
[--no-truncate]
[--output OUTPUT]
[--sort SORT]

Flags

--json
Optional

Format output as json.

Type: boolean
-a | --all
Optional

Show all environments, even inactive ones.

Type: boolean
--columns COLUMNS
Optional

List of columns to display.

Type: option
--csv
Optional

Output in csv format [alias: --output=csv]

Type: boolean
--filter FILTER
Optional

Filter property by partial string matching.

Type: option
--no-header
Optional

Hide table header from output.

Type: boolean
--no-truncate
Optional

Don't truncate output to fit screen.

Type: boolean
--output OUTPUT
Optional

Format in which to display the output.

Type: option
Permissible values are: csv, json, yaml
--sort SORT
Optional

Column to sort by (prepend '-' for descending).

Type: option

env log (Beta)

Stream log output for an environment.

This feature is a Beta Service. Customers may opt to try such Beta Service in its sole discretion. Any use of the Beta Service is subject to the applicable Beta Services Terms provided at Agreements and Terms (https://www.salesforce.com/company/legal/agreements/).

Note

Examples for env log

Stream log output:

Usage

sf env log
[--json]
[-e TARGET-COMPUTE]
[-n NUM]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Compute environment name to retrieve logs.

Type: option
-n | --num NUM
Optional

Number of lines to display.

Type: option

env log tail

Stream log output for an environment.

Examples for env log tail

Stream log output:

Usage

sf env log tail
[--json]
[-e TARGET-COMPUTE]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Compute environment name to retrieve logs.

Type: option

env logdrain add

Add log drain to a specified environment.

Description for env logdrain add

Both '--target-compute' and '--url' are required flags. '--url' should be a HTTP or HTTPS URL that can receive the log drain messages.

Examples for env logdrain add

Add a log drain:

Usage

sf env logdrain add
[--json]
[-e TARGET-COMPUTE]
[-l DRAIN-URL]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Environment name.

Type: option
-l | --drain-url DRAIN-URL
Optional

Endpoint that will receive sent logs.

Type: option

env logdrain list

List log drains connected to a specified environment.

Examples for env logdrain list

List log drains:

List log drains as json:

Usage

sf env logdrain list
[--json]
[-e TARGET-COMPUTE]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Environment name.

Type: option

env logdrain remove

Remove log drain from a specified environment.

Description for env logdrain remove

Both '--target-compute' and '--drain-url' are required flags.

Examples for env logdrain remove

Remove a logdrain:

Usage

sf env logdrain remove
[--json]
[-e TARGET-COMPUTE]
[-l DRAIN-URL]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Environment name.

Type: option
-l | --drain-url DRAIN-URL
Optional

Log drain url to remove.

Type: option

env open

Open an environment in a web browser.

Description for env open

Each of your environments is associated with an instance URL, such as https://login.salesforce.com. To open a specific web page, specify the portion of the URL after "<URL>/" with the --path flag.

Examples for env open

Open the compute environment with alias "test-compute":

View the URL but don't launch it in a browser:

Open the environment in the Google Chrome browser:

Usage

sf env open
[--json]
[-p PATH]
[-r]
[-e TARGET-ENV]
[--browser BROWSER]

Flags

--json
Optional

Format output as json.

Type: boolean
-p | --path PATH
Optional

Path to append to the end of the login URL.

Type: option
-r | --url-only
Optional

Display the URL, but don’t launch it in a browser.

Type: boolean
-e | --target-env TARGET-ENV
Optional

Login user or alias of the environment to open.

Type: option
--browser BROWSER
Optional

Browser in which to open the environment.

You can specify that the environment open in one of the following browsers: Firefox, Safari, Google Chrome, or Windows Edge. If you don’t specify --browser, the environment opens in your default browser. The exact names of the browser applications differ depending on the operating system you're on; check your documentation for details.

Type: option

env var get

Display a single config variable for an environment.

Description for env var get

You must provide the '--target-compute' flag and the key to retrieve.

Examples for env var get

Get a config variable:

Usage

sf env var get
[--json]
[-e TARGET-COMPUTE]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Environment name.

Type: option

env var list

List your environment's config vars in a table.

Description for env var list

Use the '--json' flag to return config vars in JSON format.

Examples for env var list

List config vars:

List in JSON format:

Usage

sf env var list
[--json]
[-e TARGET-COMPUTE]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Environment name.

Type: option

env var set

Set a single config value for an environment.

Examples for env var set

Set a config value:

Usage

sf env var set
[--json]
[-e TARGET-COMPUTE]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Environment name.

Type: option

env var unset

Unset a single config value for an environment.

Description for env var unset

Run 'sf env var list' to see a list of config values that can be unset.

Examples for env var unset

Unset a value:

Usage

sf env var unset
[--json]
[-e TARGET-COMPUTE]

Flags

--json
Optional

Format output as json.

Type: boolean
-e | --target-compute TARGET-COMPUTE
Optional

Environment name.

Type: option