Intranet: Show backend type on vhost page

This commit is contained in:
cytopia 2022-12-25 18:06:35 +01:00
parent ffba5d61b7
commit 10571f7b51
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
3 changed files with 32 additions and 1 deletions

View File

@ -24,6 +24,7 @@
<tr>
<th>Project</th>
<th>DocumentRoot</th>
<th>Backend</th>
<th>Config</th>
<th>Valid</th>
<th>URL</th>
@ -31,7 +32,7 @@
</thead>
<tbody>
<?php
$totals = 10;
$totals = 0;
$filler = '&nbsp;';
for ($i=0; $i<$totals; $i++) {
$filler = $filler. '&nbsp;';
@ -41,6 +42,7 @@
<tr>
<td><?php echo $vHost['name'];?></td>
<td><?php echo loadClass('Helper')->getEnv('HOST_PATH_HTTPD_DATADIR');?>/<?php echo $vHost['name'];?>/<?php echo loadClass('Helper')->getEnv('HTTPD_DOCROOT_DIR');?></td>
<td><?php echo loadClass('Httpd')->getVhostBackend($vHost['name']); ?></td>
<td>
<a title="Virtual host: <?php echo $vHost['name'];?>.conf" target="_blank" href="/vhost.d/<?php echo $vHost['name'];?>.conf"><i class="fa fa-cog" aria-hidden="true"></i></a>
<?php if (($vhostGen = loadClass('Httpd')->getVhostgenTemplatePath($vHost['name'])) !== false): ?>

View File

@ -196,6 +196,34 @@ class Httpd extends BaseClass implements BaseInterface
return false;
}
public function getVhostBackend($vhost)
{
$dir = loadClass('Helper')->getEnv('HTTPD_TEMPLATE_DIR');
$name = 'backend.cfg';
$file = '/shared/httpd/'.$vhost.'/'.$dir.'/'.$name;
if (!file_exists($file)) {
return 'default';
}
$fp = fopen($file, 'r');
$cont = stream_get_contents($fp);
fclose($fp);
// conf:<type>:<proto>:<server>:<port>
$arr = explode(':', $cont);
$type = $arr[1];
$prot = $arr[2];
$addr = '';
for ($i=3; $i<(count($arr)-1); $i++) {
$addr .= $arr[$i];
}
$addr = $arr[3]; // this may contain ':' itself
$port = $arr[count($arr) - 1];
return $prot.'://'.$addr.':'.$port;
}
/*********************************************************************************
*

View File

@ -64,6 +64,7 @@ Once it has been tested by the community, and potential errors have been address
### Added
- New HTTPD server capable of auto reverse proxy creation (and different PHP versions per project)
- Intranet: Added Command & Control center to view watcherd logs and retrigger config in case of vhost changes
- Intranet: vhost page now also shows the configured Backend
- Environment variable `DEVILBOX_HTTPD_MGMT_PASS`
- Environment variable `DEVILBOX_HTTPD_MGMT_USER`
- New Docker Compose Override file `docker-compose.override.yml-php-multi.yml` (allows to run multiple PHP versions).