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.

To set a configuration value for the current project:

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

To set the value for all your projects:

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 are running the command and all global values.

To return one or more previously set configuration values, use force:config:get. It is 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 and defaultdevhubusername:

To unset a configuration value, set it to no value. For example, to unset the instanceUrl configuration value:

You can set these CLI configuration values.

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

Note

Configuration Value Name Description Environment Variable
apiVersion The API version for a specific project or all projects. Normally, the Salesforce CLI assumes that you’re using the same version of the CLI as the Dev Hub org. However, let’s say you decide to use the pre-release version of the CLI (v43 in Summer ‘18), but your Dev Hub org is running the current API version (v42 in Spring ‘18). In this case, you’d want to set this value to match the API version of your Dev Hub org (v42).
This examples sets the API version for all projects (globally).

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

SFDX_API_VERSION
Example:
defaultusername The username for an org that all commands run against by default. SFDX_DEFAULTUSERNAME
Example:
defaultdevhubusername The username of your Dev Hub org that the force:org:create command defaults to. SFDX_DEFAULTDEVHUBUSERNAME
Example:
instanceUrl The URL of the Salesforce instance that is hosting your org. SFDX_INSTANCE_URL
Example: