MCPcopy Create free account
hub / github.com/PIKACHUIM/CFWorkerACME / dnsAdd

Function dnsAdd

src/agent.ts:12–30  ·  view source on GitHub ↗
(env: Bindings, domain_item: any, domain_name: string)

Source from the content-addressed store, hash-verified

10}
11
12export async function dnsAdd(env: Bindings, domain_item: any, domain_name: string) {
13 const [zones, email, token] = await Promise.all([
14 dcv(env, "DCV_ZONES"), dcv(env, "DCV_EMAIL"), dcv(env, "DCV_TOKEN"),
15 ]);
16 return dnsAPI(
17 "POST", `https://api.cloudflare.com/client/v4/zones/${zones}/dns_records`,
18 {
19 'Content-Type': 'application/json',
20 'X-Auth-Email': email,
21 'X-Auth-Key': token,
22 },
23 JSON.stringify({
24 comment: 'DCV-Agent#' + Date.now() + '@' + domain_name,
25 content: domain_item['auth'],
26 name: domain_item['auto'],
27 ttl: 60,
28 type: 'TXT'
29 }))
30}
31
32export async function dnsDel(env: Bindings, domain_name: string, domain_type: string = "TXT") {
33 let domain_uuid: string = await dnsUID(env, domain_name, domain_type);

Callers

nothing calls this directly

Calls 2

dcvFunction · 0.85
dnsAPIFunction · 0.85

Tested by

no test coverage detected