Skip to content

Commit f84c64f

Browse files
committed
fix: try to create local config first
1 parent 84fc66c commit f84c64f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/commands/force/org/beta/create.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,14 @@ export class Create extends SfdxCommand {
269269
this.logger.debug('Set Alias: %s result: %s', this.flags.setalias, result);
270270
}
271271
if (this.flags.setdefaultusername) {
272-
const globalConfig: Config = this.configAggregator.getGlobalConfig();
273-
globalConfig.set(Config.DEFAULT_USERNAME, username);
274-
const result = await globalConfig.write();
272+
let config: Config;
273+
try {
274+
config = await Config.create({ isGlobal: false });
275+
} catch {
276+
config = await Config.create({ isGlobal: true });
277+
}
278+
const result = config.set(Config.DEFAULT_USERNAME, username);
279+
await config.write();
275280
this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
276281
}
277282
}

0 commit comments

Comments
 (0)