From 159ef981bcee5fb7792b992551843df2618efcce Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 15 Nov 2026 21:33:35 -0700 Subject: dns-migrate: an optional domain argument (rehearse cf-cleanup on staging.coinos.io first) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6SwkivduFDDkMmnXjZ --- names/dns-migrate.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'names/dns-migrate.js') diff --git a/names/dns-migrate.js b/names/dns-migrate.js index 4753c9e..c4ae68b 100644 --- a/names/dns-migrate.js +++ b/names/dns-migrate.js @@ -3,6 +3,7 @@ // docker exec names bun names/dns-migrate.js backfill every name of a knot domain → Knot // docker exec names bun names/dns-migrate.js check Knot holds what the database says // docker exec names bun names/dns-migrate.js cf-cleanup delete the per-name TXT records from Cloudflare +// (each takes an optional domain, e.g. `cf-cleanup staging.coinos.io`) // The database is only read: the running registrar owns it. Names it writes // after the switch go to Knot themselves, and a stale Cloudflare record id // left in the database is harmless (knotWrite's cleanup of it just fails). @@ -14,7 +15,9 @@ const CFG = JSON.parse(readFileSync(process.env.NAMES_CONFIG, 'utf8')); const DOMAINS = CFG.domains || {}; const TTL = 300; const recordName = (name, domain) => `${name}.user._bitcoin-payment.${domain}`; -const knotDomains = Object.keys(DOMAINS).filter((d) => DOMAINS[d].knot); +// an optional last argument narrows a run to one domain +const only = process.argv[3]; +const knotDomains = Object.keys(DOMAINS).filter((d) => DOMAINS[d].knot && (!only || d === only)); const log = (...a) => console.log(new Date().toISOString(), ...a); function names() { -- cgit v1.2.3