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('-');