Newer Version Available

This content describes an older version of this product. View Latest

Configuration Variables

You can set configuration (config) variables for your current project or for all projects. You can set two kinds of config variables: global and local. Global config variables apply to all projects on your computer. Local config variables apply to a specific project. Local config variables override global ones when commands are run from within a Salesforce DX project directory.

To set a config variable for the current project:

For local config variables, you must issue the command from within the Salesforce DX project directory.

To set the config variable for all your projects:

You can issue global commands anywhere or within any Salesforce DX project, yet they apply to all the Salesforce CLI commands you run.

View the local and global config variables that you have set with the config list command. The output lists the local variables for the project directory from which you’re running the command and all global variables.

To return one or more previously set config variables, use config get. It’s often useful to specify JSON output for this command for easier parsing in a continuous integration (CI) environment. For example, to return the value of target-org and target-dev-hub:

To unset a config variable, run the config unset command. For example, to unset the org-instance-url config variable:

Alternately, you can set all CLI config variables as environment variables. Environment variables override config variables.

Note

You can set these CLI config variables.

org-api-version
The API version for a specific project or all projects. Normally, Salesforce CLI assumes that you’re using the same version of the CLI as the Dev Hub org.
This example sets the API version for all projects (globally) to 57.0.

Be sure not to confuse this config variable with the sourceApiVersion project option, which has a similar name. See How API Version and Source API Version Work in Salesforce CLI for more information.

Environment variable: SF_ORG_API_VERSION

org-custom-metadata-templates
Specifies either a local directory or a cloned GitHub repository that contains the default custom code templates used by the project generate command. The GitHub URL points to either the root directory that contains your templates or to a subdirectory on a branch in the repo that contains your templates. For example:

Environment variable: SF_ORG_CUSTOM_METADATA_TEMPLATES

target-org
The username for an org that all commands run against by default.

Environment variable: SF_TARGET_ORG

target-dev-hub
The username for your default Dev Hub org.

Environment variable: SF_TARGET_DEV_HUB

disable-telemetry
By default, Salesforce CLI collects usage information, user environment information, and crash reports. This option allows you to opt out.

Environment variable: SF_DISABLE_TELEMETRY

org-instance-url
The URL of the Salesforce instance that’s hosting your org. Default value is https://login.salesforce.com. We recommend that you set this config variable to the My Domain login URL for your org. You can find the My Domain login URL on the My Domain page in Setup.

Environment variable: SF_ORG_INSTANCE_URL

org-max-query-limit
The maximum number of Salesforce records returned by a Salesforce CLI command. Default value is 10,000.

For example, let’s say you run sf org list metadata -m Role on a Salesforce org that has 15,000 roles. By default the command displays only 10,000 roles. A message warns you that the command retrieved only some of the roles. To see all of them, set this config variable to a larger number.

Environment variable: SF_ORG_MAX_QUERY_LIMIT

org-metadata-rest-deploy
If true, Salesforce CLI uses Metadata REST API for deployments. By default, Salesforce CLI uses SOAP. Deployments using REST aren’t bound by the 39-MB.zip file size limit that applies to SOAP deployments.

Environment variable: SF_ORG_METADATA_REST_DEPLOY