MCPcopy Create free account
hub / github.com/pollinations/pollinations / deleteCname

Function deleteCname

apps/_scripts/deploy-app.js:284–306  ·  view source on GitHub ↗
(zoneId, headers, name)

Source from the content-addressed store, hash-verified

282}
283
284async function deleteCname(zoneId, headers, name) {
285 const { ok, json } = await cf(
286 `${CF_API}/zones/${zoneId}/dns_records?type=CNAME&name=${name}`,
287 headers,
288 );
289 if (!ok)
290 throw new Error(`DNS list ${name} failed: ${JSON.stringify(json)}`);
291
292 const record = json.result?.[0];
293 if (!record) return;
294
295 const { ok: deleteOk, json: deleted } = await cf(
296 `${CF_API}/zones/${zoneId}/dns_records/${record.id}`,
297 headers,
298 { method: "DELETE" },
299 );
300 if (!deleteOk) {
301 throw new Error(
302 `Delete CNAME ${name} failed: ${JSON.stringify(deleted)}`,
303 );
304 }
305 console.log(`Removed old CNAME ${name}`);
306}
307
308async function attachWorkerDomain(account, headers, hostname, zoneId) {
309 const { ok, json } = await cf(

Callers 1

runCutoverFunction · 0.85

Calls 3

stringifyMethod · 0.80
logMethod · 0.80
cfFunction · 0.70

Tested by

no test coverage detected