Add haproxy_cleanup_wildcards tool to remove subdomain wildcard entries

New db_remove_wildcard() for surgical wildcard-only deletion.
New haproxy_cleanup_wildcards tool scans all wildcard entries and removes
those belonging to subdomains (e.g., *.nocodb.inouter.com) while keeping
base domain wildcards (e.g., *.anvil.it.com).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-02-08 20:36:59 +09:00
parent 170c48e257
commit 2e22a5d5a8
2 changed files with 61 additions and 1 deletions

View File

@@ -355,6 +355,21 @@ def db_remove_domain(domain: str) -> None:
conn.commit()
def db_remove_wildcard(domain: str) -> bool:
"""Remove only the wildcard entry for a domain from the database.
Args:
domain: Base domain name (without leading dot, e.g., "nocodb.inouter.com").
Returns:
True if a wildcard entry was deleted, False if not found.
"""
conn = get_connection()
cur = conn.execute("DELETE FROM domains WHERE domain = ? AND is_wildcard = 1", (f".{domain}",))
conn.commit()
return cur.rowcount > 0
def db_find_available_pool() -> Optional[str]:
"""Find the first available pool not assigned to any domain.