drop shared caddy volume — koncad owns its caddyfile copy in /data

This commit is contained in:
Daniel committed 2026-04-06 23:02:27 +02:00
1 parent e2f59d4825
commit a80433c9df
2 files changed
+9 -13

No files matched your search

+5 -10
View File
@@ -1,7 +1,7 @@
<?php
// ─── Config ──────────────────────────────────────────────────────────────────
define('CADDYFILE_PATH', getenv('CADDYFILE_PATH') ?: '/etc/caddy/Caddyfile');
define('CADDY_ADMIN_URL', getenv('CADDY_ADMIN_URL') ?: 'http://localhost:2019');
define('CADDY_ADMIN_URL', getenv('CADDY_ADMIN_URL') ?: 'http://localhost:2019');
define('CADDYFILE_STORE', getenv('CADDYFILE_STORE') ?: '/data/Caddyfile');
// ─── Helpers ─────────────────────────────────────────────────────────────────
function parseCaddyfile(string $content): array {
@@ -102,7 +102,7 @@ if (isset($_GET['action'])) {
exit;
case 'load':
$raw = file_exists(CADDYFILE_PATH) ? file_get_contents(CADDYFILE_PATH) : '';
$raw = file_exists(CADDYFILE_STORE) ? file_get_contents(CADDYFILE_STORE) : '';
echo json_encode(['ok' => true, 'data' => parseCaddyfile($raw)]);
exit;
@@ -112,13 +112,8 @@ if (isset($_GET['action'])) {
$cf = buildCaddyfile($input['global'] ?? '', $input['sites'] ?? []);
$result = caddyLoad($cf);
if (!$result['ok']) { echo json_encode($result); exit; }
if (file_put_contents(CADDYFILE_PATH, $cf) === false) {
echo json_encode(['ok' => false, 'error' => 'Config applied but failed to write Caddyfile to disk']);
exit;
}
echo json_encode(['ok' => true]);
if ($result['ok']) file_put_contents(CADDYFILE_STORE, $cf);
echo json_encode($result);
exit;
case 'check_upstreams':