Browse Source

adding #45

master
Björn 4 years ago
parent
commit
c7b6430dca
2 changed files with 26 additions and 3 deletions
  1. +0
    -2
      app/Factories/NginxVhostFactory.php
  2. +26
    -1
      app/Helpers/NginxVhostHelper.php

+ 0
- 2
app/Factories/NginxVhostFactory.php View File

@ -136,8 +136,6 @@ class NginxVhostFactory
->addMenuItem($checkbox)
->addLineBreak('-');
var_dump($vhost); die();
if ($vhost['ssl'] === true) {
if ($vhost['ssl_certificate_exists']) {
$builder->addStaticItem('expired_at: '.$vhost['ssl_certificate_expired_at']);


+ 26
- 1
app/Helpers/NginxVhostHelper.php View File

@ -98,6 +98,27 @@ class NginxVhostHelper
return $result;
}
/**
*
* @return
*/
private function getRedirect($path, $domain)
{
// getting .conf-file
$content = file_get_contents($path);
// result
$result = false;
preg_match('/server_name www.'.$domain.'/', $content, $matches);
if (count($matches) > 0) {
$result = true;
}
return $result;
}
/**
* get vhost
*
@ -113,10 +134,14 @@ class NginxVhostHelper
// getting certificates from a configuration
$certificate = $this->getCertificate($path);
// domain
$domain = str_replace('.conf', '', $filename);
$result = array_merge([
'domain' => str_replace('.conf', '', $filename),
'domain' => $domain,
'path' => $path,
'file' => $filename,
'redirect_www' => $this->getRedirect($path, $domain)
'enabled' => in_array($filename, $enabled),
], $certificate);


Loading…
Cancel
Save