Skip to content

Commit

Permalink
Simply the async/promise startup code
Browse files Browse the repository at this point in the history
  • Loading branch information
jnmullen authored and mansurpasha committed May 4, 2020
1 parent 979c807 commit d474c7e
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,32 +549,26 @@ function promptRegion() {
});
}

async function getAwsCreds() {
function startTool() {
const creds = getAWSCredentials();

(async () => {
await creds
.getPromise()
.then(() => {
AWS.config.credentials = creds;
updateAWSServices();

if (!program.region) {
promptRegion();
} else if (!program.stackName) {
promptStackName();
} else {
new Main().render();
}
})
.catch((error) => {
console.log(JSON.stringify(creds), "error:", error);
});
})();
}

async function startTool() {
await getAwsCreds();
creds
.getPromise()
.then(() => {
AWS.config.credentials = creds;
updateAWSServices();

if (!program.region) {
promptRegion();
} else if (!program.stackName) {
promptStackName();
} else {
new Main().render();
}
})
.catch((error) => {
console.log(JSON.stringify(creds), "error:", error);
});
}

startTool();
Expand Down

0 comments on commit d474c7e

Please sign in to comment.