aboutsummaryrefslogtreecommitdiffstats
path: root/names
diff options
context:
space:
mode:
Diffstat (limited to 'names')
-rw-r--r--names/dns-migrate.js5
1 files changed, 4 insertions, 1 deletions
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() {