This commit is contained in:
2025-09-08 13:59:28 +02:00
parent b99533ced8
commit 19bdd41664
2 changed files with 7 additions and 3 deletions

5
add-container.php Normal file
View File

@ -0,0 +1,5 @@
<?php
if (count($argv) !== 3) return;
$config = json_decode(file_get_contents(__DIR__ . '/api/config.json'), true);
$config[$argv[1]] = $argv[2];
file_put_contents(__DIR__ . '/api/config.json', json_encode($config));

View File

@ -27,7 +27,6 @@ $lxd = new LxdService();
// === Helper URLs === // === Helper URLs ===
$redirectBase = parseUrl("$host/app"); $redirectBase = parseUrl("$host/app");
$waitingPage = parseUrl("$host/app/waiting?name=$container&redirect=" . urlencode(getFullUrl()));
// === If container is missing or invalid === // === If container is missing or invalid ===
if (!$container || !$lxd->containerExists($container)) { if (!$container || !$lxd->containerExists($container)) {
redirect($redirectBase); redirect($redirectBase);
@ -44,8 +43,8 @@ if ($state !== 'Running') {
$nginx = $lxd->getContainerServiceStatus($container, 'nginx'); $nginx = $lxd->getContainerServiceStatus($container, 'nginx');
$mysql = $lxd->getContainerServiceStatus($container, 'mariadb'); $mysql = $lxd->getContainerServiceStatus($container, 'mariadb');
if (!$ip || $nginx !== 'active' || $mysql !== 'active') { if ($nginx !== 'active' || $mysql !== 'active') {
redirect($waitingPage); redirect($redirectBase);
} }
// === Proxy to container === // === Proxy to container ===