1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 08:10:07 +01:00

Merge pull request #1498 from adrum/feature/renew-ca

Add the ability to renew the Certificate Authority certificate
This commit is contained in:
Matt Stauffer
2024-12-09 20:37:05 -05:00
committed by GitHub
2 changed files with 28 additions and 8 deletions

View File

@@ -285,9 +285,9 @@ function (ConsoleCommandEvent $event) {
/**
* Display all of the currently secured sites.
*/
$app->command('secured [--expiring] [--days=]', function (OutputInterface $output, $expiring = null, $days = 60) {
$app->command('secured [--expiring] [--days=] [--ca]', function (OutputInterface $output, $expiring = null, $days = 60, $ca = null) {
$now = (new Datetime)->add(new DateInterval('P'.$days.'D'));
$sites = collect(Site::securedWithDates())
$sites = collect(Site::securedWithDates($ca))
->when($expiring, fn ($collection) => $collection->filter(fn ($row) => $row['exp'] < $now))
->map(function ($row) {
return [
@@ -301,16 +301,18 @@ function (ConsoleCommandEvent $event) {
})->descriptions('Display all of the currently secured sites', [
'--expiring' => 'Limits the results to only sites expiring within the next 60 days.',
'--days' => 'To be used with --expiring. Limits the results to only sites expiring within the next X days. Default is set to 60.',
'--ca' => 'Include the Certificate Authority certificate in the list of site certificates.',
]);
/**
* Renews all domains with a trusted TLS certificate.
*/
$app->command('renew [--expireIn=]', function (OutputInterface $output, $expireIn = 368) {
Site::renew($expireIn);
$app->command('renew [--expireIn=] [--ca]', function (OutputInterface $output, $expireIn = 368, $ca = null) {
Site::renew($expireIn, $ca);
Nginx::restart();
})->descriptions('Renews all domains with a trusted TLS certificate.', [
'--expireIn' => 'The amount of days the self signed certificate is valid for. Default is set to "368"',
'--ca' => 'Renew the Certificate Authority certificate before renewing the site certificates.',
]);
/**