fix: preserve PK01 Caddy host blocks
This commit is contained in:
@@ -367,7 +367,10 @@ for source in (current, desired):
|
||||
order.append(name)
|
||||
blocks[name] = match.group(0).rstrip() + "\n"
|
||||
|
||||
base = pattern.sub("", desired)
|
||||
# Preserve host-owned site blocks and nested managed blocks from the active
|
||||
# Caddyfile; service-specific applies should only upsert top-level blocks.
|
||||
base_source = "current" if current.strip() else "desired"
|
||||
base = pattern.sub("", current if base_source == "current" else desired)
|
||||
for domain in legacy_domains:
|
||||
base = remove_site_blocks(base, domain)
|
||||
base = base.rstrip()
|
||||
@@ -376,7 +379,13 @@ next_text = base
|
||||
if managed:
|
||||
next_text = next_text + "\n\n" + managed
|
||||
merged_path.write_text(next_text.rstrip() + "\n", encoding="utf-8")
|
||||
print(json.dumps({"currentManagedBlocks": len(pattern.findall(current)), "desiredManagedBlocks": len(pattern.findall(desired)), "mergedManagedBlocks": len(blocks)}))`;
|
||||
print(json.dumps({
|
||||
"baseSource": base_source,
|
||||
"legacyDomains": legacy_domains,
|
||||
"currentManagedBlocks": len(pattern.findall(current)),
|
||||
"desiredManagedBlocks": len(pattern.findall(desired)),
|
||||
"mergedManagedBlocks": len(blocks),
|
||||
}))`;
|
||||
}
|
||||
|
||||
function managedBlockPattern(): RegExp {
|
||||
|
||||
Reference in New Issue
Block a user