Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static async getDefaultUsername() {
if(vscode.workspace && vscode.workspace.workspaceFolders) {
const rootPath = vscode.workspace.workspaceFolders[0].uri.fsPath;
const myLocalConfig = await sfcore.ConfigFile.create({
isGlobal: false,
rootFolder: path.join(rootPath, '.sfdx'),
filename: 'sfdx-config.json'
});
const localValue = myLocalConfig.get('defaultusername');
let defaultusername = await sfcore.Aliases.fetch(JSON.stringify(localValue).replace(/\"/g, ''));
return defaultusername;
}
}
}