From fc523207afd1a8cb7302d0b4e4b1eedf6123ca7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Mon, 21 Sep 2020 19:42:35 +0200 Subject: [PATCH] adding #45 --- app/Factories/NginxVhostFactory.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/Factories/NginxVhostFactory.php b/app/Factories/NginxVhostFactory.php index 205d0bc..f511fa9 100644 --- a/app/Factories/NginxVhostFactory.php +++ b/app/Factories/NginxVhostFactory.php @@ -136,11 +136,22 @@ class NginxVhostFactory ->addMenuItem($checkbox) ->addLineBreak('-'); - if ($vhost['ssl']) { + if ($vhost['ssl'] === true) { if ($vhost['ssl_certificate_exists']) { $builder->addStaticItem('expired_at: '.$vhost['ssl_certificate_expired_at']); } else { - $builder->addStaticItem('no certificate'); + $builder->addItem('add certificate', function(CliMenu $menu) { + $result = $menu->askText() + ->setPromptText('Enter E-Mail') + ->ask(); + + $email = $result->fetch(); + $this->call('lets-encrypt:add', [ 'email' => $email, 'domain' => $vhost['domain'] ]); + + if ($vhost['redirect_www'] === true) { + $this->call('lets-encrypt:add', [ 'email' => $email, 'domain' => 'www.'.$vhost['domain'] ]); + } + }); } $builder->addLineBreak('-');