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:

1sf config set name <value>

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:

1sf config set name <value> --global

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.

1sf config list
1List Config
2==========================================================
3| Name                Value                       Location 
4| ─────────────────── ─────────────────────────── ──────── 
5| org-instance-url    https://test.salesforce.com Local    
6| org-max-query-limit 20000                       Local    
7| target-dev-hub      DevHub                      Local

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:

1sf config get target-org target-dev-hub --json

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

1sf config unset org-instance-url

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

Note

List of Configuration Variables

These are the Salesforce CLI configuration 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.
1sf config set org-api-version 57.0 --global

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

1SF_ORG_API_VERSION=57.0

org-capitalize-record-types

Specifies whether Salesforce CLI capitalizes the first letter of a default record type when it creates a scratch org. Valid values are true or false. The default value is true.

Default record types are defined in the objectSettings option of a scratch org definition file, as described in Scratch Org Definition File Options. The setting is required before installing a package that creates record types. 

1sf config set org-capitalize-record-types false --global

Environment variable: SF_CAPITALIZE_RECORD_TYPES

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:

1sf config set org-custom-metadata-templates https://github.com/mygithubacct/salesforcedx-templates

Environment variable: SF_ORG_CUSTOM_METADATA_TEMPLATES

1SF_ORG_CUSTOM_METADATA_TEMPLATES=https://github.com/mygithubacct/salesforcedx-templates

target-org

The username or alias for an org that all commands run against by default.

1sf config set target-org test-scratch-org@example.com

Environment variable: SF_TARGET_ORG

1SF_TARGET_ORG=test-scratch-org@example.com

target-dev-hub

The username or alias for your default Dev Hub org.

1sf config set target-dev-hub my-dev-hub@devhub.org

Environment variable: SF_TARGET_DEV_HUB

1SF_TARGET_DEV_HUB=my-dev-hub@devhub.org

target-devops-center (DevOps Center commands only)

The username or alias for the org in which DevOps Center is installed.

1sf config set target-devops-center myDevOpsCenterOrg@example.com

disable-telemetry

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

1sf config set disable-telemetry true

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.

1sf config set org-instance-url https://yoda.my.salesforce.com

Environment variable: SF_ORG_INSTANCE_URL

1SF_ORG_INSTANCE_URL=https://yoda.my.salesforce.com

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.

1sf config set org-max-query-limit 20000

Environment variable: SF_ORG_MAX_QUERY_LIMIT

1SF_ORG_MAX_QUERY_LIMIT=200000

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.

1sf config set org-metadata-rest-deploy true

Environment variable: SF_ORG_METADATA_REST_DEPLOY