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 Config2==========================================================3| Name Value Location4| ─────────────────── ─────────────────────────── ────────5| org-instance-url https://test.salesforce.com Local6| org-max-query-limit 20000 Local7| 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.
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
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
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.