Skip to content

Commit

Permalink
do not ask for additional okta properties if not selected (#16306)
Browse files Browse the repository at this point in the history
* do not ask for additional okta properties if not selected

updates #16299

* add timeout to check for heroku login status correctly

closes #16299
  • Loading branch information
atomfrede authored Sep 16, 2021
1 parent 05c3393 commit dd097e5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions generators/heroku/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ module.exports = class extends BaseBlueprintGenerator {
default: 1,
},
{
when: answers => answers.useOkta,
type: 'input',
name: 'oktaAdminLogin',
message: 'Login (valid email) for the JHipster Admin user:',
Expand All @@ -255,6 +256,7 @@ module.exports = class extends BaseBlueprintGenerator {
},
},
{
when: answers => answers.useOkta,
type: 'confirm',
name: 'oktaAdminPassword',
message: `${chalk.blue('Take note of this password!')} You will need it on your first login: ${chalk.blue(
Expand Down Expand Up @@ -391,7 +393,7 @@ module.exports = class extends BaseBlueprintGenerator {
const regionParams = this.herokuRegion !== 'us' ? ` --region ${this.herokuRegion}` : '';

this.log(chalk.bold('\nCreating Heroku application and setting up node environment'));
const child = ChildProcess.exec(`heroku create ${this.herokuAppName}${regionParams}`, (err, stdout, stderr) => {
const child = ChildProcess.exec(`heroku create ${this.herokuAppName}${regionParams}`, { timeout: 6000 }, (err, stdout, stderr) => {
if (err) {
if (stderr.includes('is already taken')) {
const prompts = [
Expand Down Expand Up @@ -458,7 +460,11 @@ module.exports = class extends BaseBlueprintGenerator {
});
} else {
this.abort = true;
this.log.error(err);
if (stderr.includes('Invalid credentials')) {
this.log.error("Error: Not authenticated. Run 'heroku login' to login to your heroku account and try again.");
} else {
this.log.error(err);
}
done();
}
} else {
Expand Down

0 comments on commit dd097e5

Please sign in to comment.