Skip to content

Commit

Permalink
fix: update config vars
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Apr 15, 2022
1 parent 7d6f7da commit 0c557b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/flags/orgApiVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { Flags } from '@oclif/core';
import { Messages, sfdc, Lifecycle } from '@salesforce/core';
import { Messages, sfdc, Lifecycle, OrgConfigProperties } from '@salesforce/core';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
Expand Down Expand Up @@ -34,7 +34,7 @@ const getDefaultFromConfig = async (): Promise<string | undefined> => {
// (perf) only import ConfigAggregator if necessary
const { ConfigAggregator } = await import('@salesforce/core');
const config = await ConfigAggregator.create();
const apiVersionFromConfig = config.getInfo('apiVersion')?.value as string;
const apiVersionFromConfig = config.getInfo(OrgConfigProperties.ORG_API_VERSION)?.value as string;
if (apiVersionFromConfig) {
await Lifecycle.getInstance().emitWarning(
messages.getMessage('flags.apiVersion.overrideWarning', [apiVersionFromConfig])
Expand Down
5 changes: 2 additions & 3 deletions src/flags/orgFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { Flags } from '@oclif/core';
import { Messages, Org, ConfigAggregator } from '@salesforce/core';
import { Messages, Org, ConfigAggregator, OrgConfigProperties } from '@salesforce/core';

Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
Expand Down Expand Up @@ -34,8 +34,7 @@ const getHubOrThrow = async (aliasOrUsername?: string): Promise<Org> => {
if (!aliasOrUsername) {
// check config for a default
const config = await ConfigAggregator.create();
aliasOrUsername =
(config.getInfo('target-dev-hub')?.value as string) ?? (config.getInfo('defaultdevhubusername')?.value as string);
aliasOrUsername = config.getInfo(OrgConfigProperties.TARGET_DEV_HUB)?.value as string;
if (!aliasOrUsername) {
throw messages.createError('errors.NoDefaultDevHub');
}
Expand Down

0 comments on commit 0c557b5

Please sign in to comment.