Failover Coverage and Shared Services pickers on the Partnership page

Coverage edits FALLBACK_<me>_TIER1-4 directly — the array fallback.sh reads during an outage — rather than a parallel list that could drift from it.
This commit is contained in:
Gmer4Lfe
2026-08-17 15:10:32 -04:00
parent d7980da35e
commit e8ee5b052b
2 changed files with 172 additions and 0 deletions
+20
View File
@@ -109,11 +109,31 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
// ── Write ────────────────────────────────────────────────────────────────────────────────────
$action = $_POST['action'] ?? '';
// Containers this host runs, PLUS whatever the lists already name. The conf legitimately holds
// entries for containers that are not here right now — one removed since it was added, one
// living on a partner, one simply stopped. Validating only against the running set would refuse
// to save a list the operator had not touched: FALLBACK_HOST1_TIER4 still carries "LidaTube",
// which no longer exists here, so opening the card and pressing Save would fail on a line
// nobody had edited.
//
// New names still have to be real. The guard is against inventing containers, not against
// keeping ones already recorded.
$known = [];
foreach (vv_docker_containers() as $c) {
$n = is_array($c) ? ($c['name'] ?? '') : (string)$c;
if ($n !== '') $known[strtolower($n)] = $n;
}
$existingRaw = vv_read_conf_raw($myConf);
foreach ($TIERS as $t) {
foreach (vv_parse_conf_list($existingRaw, $tierVar($t)) as $n) {
$n = trim($n);
if ($n !== '' && !isset($known[strtolower($n)])) $known[strtolower($n)] = $n;
}
}
foreach (vv_parse_conf_list($existingRaw, $svcVar) as $x) {
$n = $fromXml($x);
if ($n !== '' && !isset($known[strtolower($n)])) $known[strtolower($n)] = $n;
}
// Rewrites one `NAME=(` … `)` block in place, preserving the leading indent the conf uses.
$rewrite = function (string $cur, string $var, array $items): ?string {