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

restored original secured command

This commit is contained in:
Austin Drummond
2023-12-20 00:07:57 -05:00
parent eec8d5f0fc
commit 86c40dd40c
2 changed files with 25 additions and 15 deletions

View File

@@ -424,28 +424,38 @@ public function replaceOldLoopbackWithNew(string $siteConf, string $old, string
}
/**
* Get all of the URLs with expiration dates that are currently secured.
* Get all of the URLs that are currently secured.
*/
public function secured(): array
{
return collect($this->files->scandir($this->certificatesPath()))
->filter(function ($file) {
return ends_with($file, ['.crt']);
return ends_with($file, ['.key', '.csr', '.crt', '.conf']);
})->map(function ($file) {
$host = str_replace(['.crt'], '', $file);
$filePath = $this->certificatesPath() . '/' . $file;
$expiration = $this->cli->run("openssl x509 -enddate -noout -in $filePath");
return [
'host' => $host,
'exp' => new DateTime(str_replace('notAfter=', '', $expiration)),
];
return str_replace(['.key', '.csr', '.crt', '.conf'], '', $file);
})->unique()->values()->all();
}
/**
* Get all of the URLs with expiration dates that are currently secured.
*/
public function securedWithDates(): array
{
return collect($this->secured())->map(function ($site) {
$filePath = $this->certificatesPath() . '/' . $site . '.crt';
$expiration = $this->cli->run("openssl x509 -enddate -noout -in $filePath");
$expiration = str_replace('notAfter=', '', $expiration);
return [
'site' => $site,
'exp' => new DateTime($expiration),
];
})->unique()->values()->all();
}
public function isSecured(string $site): bool
{
$tld = $this->config->read()['tld'];