From d518ab15c7ddda0732b32b77bf7ccbedff43524a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Sun, 9 Aug 2020 22:20:23 +0200 Subject: [PATCH] adding --- app/Commands/LetsEncryptAddCommand.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Commands/LetsEncryptAddCommand.php b/app/Commands/LetsEncryptAddCommand.php index b51c8d5..8d3ba56 100644 --- a/app/Commands/LetsEncryptAddCommand.php +++ b/app/Commands/LetsEncryptAddCommand.php @@ -40,18 +40,27 @@ class LetsEncryptAddCommand extends Command { $domains = $this->argument('domain'); + // adding flags $domainFlags = ''; + // add file for domain + $saved = []; + + // create flags foreach($domains as $domain) { $domainFlags .= '-d '.$domain.' '; + $saved[$domain] = '/etc/letsencrypt/live/'.$domain.'/fullchain.pem'; } exec('certbot --non-interactive --agree-tos -m '.$this->argument('email').' --nginx '.$domainFlags, $output); $this->line(implode("\n", $output)); - foreach($output as $line) { - //Congratulations! - //check for string + foreach($saved as $domain => $file) { + if (file_exists($file)) { + $this->info($domain.'...Success!'); + } else { + $this->error($domain.'...Failed!'); + } } } }