1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

NEW MACROS: DOMAIN_ELSEWHERE and DOMAIN_ELSEWHERE_AUTO (#1237)

* NEW MACROS: DOMAIN_ELSEWHERE and DOMAIN_ELSEWHERE_AUTO
* Finish docs
This commit is contained in:
Tom Limoncelli
2021-09-02 15:41:22 -04:00
committed by GitHub
parent 0bf229e36d
commit 3fa5712232
4 changed files with 115 additions and 0 deletions

View File

@ -1136,3 +1136,32 @@ function CLI_DEFAULTS(defaults) {
function FETCH() {
return fetch.apply(null, arguments).catch(PANIC);
}
// DOMAIN_ELSEWHERE is a helper macro that delegates a domain to a
// static list of nameservers. It updates the registrar (the parent)
// with a list of nameservers. This is used when we own the domain (we
// control the registrar) but something else controls the DNS records
// (often a third-party of Azure).
// Usage: DOMAIN_ELSEWHERE("example.com", REG_NAMEDOTCOM, ["ns1.foo.com", "ns2.foo.com"]);
function DOMAIN_ELSEWHERE(domain, registrar, nslist) {
D(domain, registrar, NO_PURGE);
// NB(tlim): NO_PURGE is added as a precaution since something else
// is maintaining the DNS records in that zone. In theory this is
// not needed since this domain won't have a DSP defined.
for (i = 0; i < nslist.length; i++) {
D_EXTEND(domain, NAMESERVER(nslist[i]));
}
}
// DOMAIN_ELSEWHERE_AUTO is similar to DOMAIN_ELSEWHERE but the list of
// nameservers is queried from a DNS Service Provider.
// Usage: DOMAIN_ELSEWHERE_AUTO("example.com", REG_NAMEDOTCOM, DNS_FOO)
function DOMAIN_ELSEWHERE_AUTO(domain, registrar, dsplist) {
D(domain, registrar, NO_PURGE);
// NB(tlim): NO_PURGE is required since something else
// is maintaining the DNS records in that zone, and we have access
// to updating it (but we don't want to use it.)
for (i = 2; i < arguments.length; i++) {
D_EXTEND(domain, DnsProvider(arguments[i]));
}
}