Newer Version Available

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

CLI Runtime Configuration Values

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

As we improve Salesforce CLI by bringing new features from sf to sfdx, we’re also slowly updating the Salesforce DX documentation to reflect the new sf styles and names. For example, when we show a sample sfdx command, we show the equivalent sf one.

For configuration variables, we’ve deprecated the sfdx names in favor of the new sf ones. You can still use the old names, but we display a deprecation warning to nudge you towards the new names. We recommend that you start using the new names as soon as possible. This topic shows both the deprecated sfdx names and the new sf ones.

Important

To set a configuration value for the current project:

1sfdx config:set name=<value>
2sf config set name=<value>

For local configuration values, you must issue this command from within the Salesforce DX project directory.

To set the value for all your projects:

1sfdx config:set name=<value> --global
2sf config set name=<value> --global

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

You can view the local and global configuration values that you have set. The output lists the local values for the project directory from which you’re running the command and all global values.

1sfdx config:list
2sf 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 configuration values, 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 defaultusername (target-org) and defaultdevhubusername (target-dev-hub):

1sfdx config:get defaultusername defaultdevhubusername --json
2sf config get target-org target-dev-hub --json

To unset a configuration value, run the config unset command. For example, to unset the instanceUrl (org-instance-url) configuration value:

1sfdx config:unset instanceUrl
2sf config unset org-instance-url

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

Note

You can set these CLI configuration values.

apiVersion (sfdx), org-api-version (sf)
The API version for a specific project or all projects. Normally, the 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 51.0.
1sfdx config:set apiVersion=57.0 --global
2sf config set org-api-version=57.0 --global

Be sure not to confuse this CLI configuration value with the sourceApiVersion project configuration value, which has a similar name.

Environment variable: SFDX_API_VERSION (sfdx), SF_ORG_API_VERSION (sf)

1SFDX_API_VERSION=57.0
customOrgMetadataTemplates (sfdx), org-custom-metadata-templates (sf)
Specifies either a local directory or a cloned GitHub repository that contains the default custom code templates used by the force:project:create 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:
1sfdx config:set customOrgMetadataTemplates=https://github.com/mygithubacct/salesforcedx-templates
2sf config set org-custom-metadata-templates=https://github.com/mygithubacct/salesforcedx-templates

Environment variable: SFDX_CUSTOM_ORG_METADATA_TEMPLATES (sfdx), SF_ORG_CUSTOM_METADATA_TEMPLATES (sf)

1SFDX_CUSTOM_ORG_METADATA_TEMPLATES=https://github.com/mygithubacct/salesforcedx-templates
defaultusername (sfdx), target-org (sf)
The username for an org that all commands run against by default.
1sfdx config:set defaultusername=test-scratch-org@example.com
2sf config set target-org=test-scratch-org@example.com

Environment variable: SFDX_DEFAULTUSERNAME (sfdx), SF_TARGET_ORG (sf)

1SFDX_DEFAULTUSERNAME=test-scratch-org@example.com
defaultdevhubusername (sfdx), target-dev-hub (sf)
The username for your default Dev Hub org.
1sfdx config:set defaultdevhubusername=my-dev-hub@devhub.org
2sf config set target-dev-hub=my-dev-hub@devhub.org

Environment variable: SFDX_DEFAULTDEVHUBUSERNAME (sfdx), SF_TARGET_DEV_HUB (sf)

1SFDX_DEFAULTDEVHUBUSERNAME=my-dev-hub@devhub.org
disableTelemetry (sfdx), disable-telemetry (sf)
By default, the CLI collects usage information, user environment information, and crash reports. This option enables you to opt out.
1sfdx config:set disableTelemetry=true
2sf config set disable-telemetry=true

Environment variable: SFDX_DISABLE_TELEMETRY (sfdx), SF_DISABLE_TELEMETRY (sf)

instanceUrl (sfdx), org-instance-url (sf)
The URL of the Salesforce instance that is hosting your org. Default value is https://login.salesforce.com. We recommend that you set this value to the My Domain login URL for your org. You can find the My Domain login URL on the My Domain page in Setup.
1sfdx config:set instanceUrl=https://yoda.my.salesforce.com
2sf config set org-instance-url=https://yoda.my.salesforce.com

Environment variable: SFDX_INSTANCE_URL (sfdx), SF_ORG_INSTANCE_URL (sf)

1SFDX_INSTANCE_URL=https://yoda.my.salesforce.com
maxQueryLimit (sfdx), org-max-query-limit (sf)
The maximum number of Salesforce records returned by a CLI command. Default value is 10,000.

For example, let’s say you run sfdx force:mdapi:listmetadata -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 value to a larger number.

1sfdx config:set maxQueryLimit=20000
2sf config set org-max-query-limit=20000

Environment variable: SFDX_MAX_QUERY_LIMIT (sfdx), SF_ORG_MAX_QUERY_LIMIT (sf)

1SFDX_MAX_QUERY_LIMIT=200000
restDeploy (sfdx), org-metadata-rest-deploy (sf)
If true, the 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.
1sfdx config:set restDeploy=true
2sf config set org-metadata-rest-deploy=true

Environment variable: SFDX_REST_DEPLOY (sfdx), SF_ORG_METADATA_REST_DEPLOY (sf)