Skip to content

Commit 72845a3

Browse files
committed
throw exception if trust CA is canceled
1 parent 35b32b6 commit 72845a3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cli/Valet/Site.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,14 @@ public function createSigningRequest(string $url, string $keyPath, string $csrPa
640640
*/
641641
public function trustCa(string $caPemPath): void
642642
{
643-
$this->cli->run(sprintf(
644-
'sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "%s"', $caPemPath
643+
info('Trusting Laravel Valet Certificate Authority...');
644+
$result = $this->cli->run(sprintf(
645+
'sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "%s"',
646+
$caPemPath
645647
));
648+
if ($result) {
649+
throw new DomainException('The Certificate Authority must be trusted. Please run the command again.');
650+
}
646651
}
647652

648653
/**

0 commit comments

Comments
 (0)