Skip to content

Commit

Permalink
Added "always-no" option to secret generate command (#1841)
Browse files Browse the repository at this point in the history
* "skip" option added to JWT secret generation

* Changed option "skip" to "always-no"
  • Loading branch information
orkhanahmadov authored and tymondesigns committed Jul 9, 2019
1 parent d9fa7e2 commit 5942116
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Console/JWTGenerateSecretCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class JWTGenerateSecretCommand extends Command
*/
protected $signature = 'jwt:secret
{--s|show : Display the key instead of modifying files.}
{--always-no : Skip generating key if it already exists.}
{--f|force : Skip confirmation when overwriting an existing key.}';

/**
Expand Down Expand Up @@ -55,6 +56,12 @@ public function handle()
// create new entry
file_put_contents($path, PHP_EOL."JWT_SECRET=$key".PHP_EOL, FILE_APPEND);
} else {
if ($this->option('always-no')) {
$this->comment('Secret key already exists. Skipping...');

return;
}

if ($this->isConfirmed() === false) {
$this->comment('Phew... No changes were made to your secret key.');

Expand Down

0 comments on commit 5942116

Please sign in to comment.