Configuration and Environment Variable Names Migration
Configuration Variables
The sfdx-style configuration variables are aliased to their sf-style equivalents. As a result, you can use either the sfdx or the sf variable names with the config commands. But the commands always work on the sf variable names. For example, config set and config unset always set the configuration with the sf name, even if you specify the sfdx name. All config commands display the sf name in their outputs, even if you specified the sfdx name in the command.
These examples show the rules in action.
1sf config set defaultusername=my-scratch-org
2Warning: Deprecated config name: defaultusername. Please use target-org instead.
3Set Config
4===================================
5| Name Value Success
6| ────────── ────────────── ───────
7| target-org my-scratch-org true
8
9sf config list
10List Config
11===========================================
12| Name Value Location
13| ───────────────── ────────────── ────────
14| target-org my-scratch-org Local
15
16sf config get defaultusername
17Warning: Deprecated config name: defaultusername. Please use target-org instead.
18Get Config
19===================================
20| Name Value Success
21| ────────── ────────────── ───────
22| target-org my-scratch-org trueUse this table to migrate your scripts to use the new sf-style configuration variable names.
| sfdx-style Configuration Value | Equivalent sf-style Configuration Variable |
|---|---|
| apiVersion | org-api-version |
| customOrgMetadataTemplates | org-custom-metadata-templates |
| defaultdevhubusername | target-dev-hub |
| defaultusername | target-org |
| disableTelemetry | disable-telemetry |
| instanceUrl | org-instance-url |
| maxQueryLimit | org-max-query-limit |
| restDeploy | org-metadata-rest-deploy |
Environment Variables
You can set both the new sf-style and old sfdx-style environment variables. However, if they’re set to different values, Salesforce CLI uses the sf one and displays a warning.
To migrate most environment variables, change the initial SFDX to SF. However, some variables have bigger changes, as displayed in this table, while others haven’t changed their name. For the full list, see Salesforce CLI Environment Variables.
| Equivalent sf-style Environment Variable | Equivalent sf-style Environment Variable |
|---|---|
| SFDX_API_VERSION | SF_ORG_API_VERSION |
| SFDX_CUSTOM_ORG_METADATA_TEMPLATES | SF_ORG_CUSTOM_METADATA_TEMPLATES |
| SFDX_DEFAULTDEVHUBUSERNAME | SF_TARGET_DEV_HUB |
| SFDX_DEFAULTUSERNAME | SF_TARGET_ORG |
| SFDX_INSTANCE_URL | SF_ORG_INSTANCE_URL |
| SFDX_MAX_QUERY_LIMIT | SF_ORG_MAX_QUERY_LIMIT |
| SFDX_REST_DEPLOY | SF_ORG_METADATA_REST_DEPLOY |
For example, here’s how to set your default Dev Hub org to an alias with an environment variable before running the command to create a scratch org.
1SF_TARGET_DEV_HUB=MyDevHub sf org create scratch --definition-file config/scratch-def.json