Skip to content

Commit 299df31

Browse files
authored
Merge pull request #1049 from MrMage/patch-1
[7.0] Make passport:keys only generate keys when needed.
2 parents a738f62 + 137d6a7 commit 299df31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Console/KeysCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ class KeysCommand extends Command
3333
*/
3434
public function handle(RSA $rsa)
3535
{
36-
$keys = $rsa->createKey($this->input ? (int) $this->option('length') : 4096);
37-
3836
[$publicKey, $privateKey] = [
3937
Passport::keyPath('oauth-public.key'),
4038
Passport::keyPath('oauth-private.key'),
@@ -43,6 +41,8 @@ public function handle(RSA $rsa)
4341
if ((file_exists($publicKey) || file_exists($privateKey)) && ! $this->option('force')) {
4442
$this->error('Encryption keys already exist. Use the --force option to overwrite them.');
4543
} else {
44+
$keys = $rsa->createKey($this->input ? (int) $this->option('length') : 4096);
45+
4646
file_put_contents($publicKey, Arr::get($keys, 'publickey'));
4747
file_put_contents($privateKey, Arr::get($keys, 'privatekey'));
4848

0 commit comments

Comments
 (0)