DOCS: Fix examples in documentation (#1435)

* Add example include

* Replace example includes

* Remove old example includes
This commit is contained in:
Julius Rickert 2022-03-04 13:49:03 +01:00 committed by GitHub
parent 619487738f
commit 6f9e2797b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 143 additions and 143 deletions

View file

@ -12,8 +12,7 @@ The address should be an ip address, either a string, or a numeric value obtaine
Modifiers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider("R53"),
A("@", "1.2.3.4"),
@ -22,5 +21,6 @@ D("example.com", REGISTRAR, DnsProvider("R53"),
A("*", "1.2.3.4", {foo: 42})
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -12,8 +12,7 @@ The address should be an IPv6 address as a string.
Modifiers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.
{% include startExample.html %}
{% capture example %}
```js
var addrV6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
@ -24,5 +23,6 @@ D("example.com", REGISTRAR, DnsProvider("R53"),
AAAA("*", addrV6, {foo: 42})
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -14,12 +14,12 @@ The name should be the relative label for the domain.
Target should be a string representing the target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider("CLOUDFLARE"),
ALIAS("@", "google.com."), // example.com -> google.com
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -17,8 +17,7 @@ data model.
NOTE: No parenthesis should follow these keywords. That is, the
correct syntax is `AUTODNSSEC_ON` not `AUTODNSSEC_ON()`
{% include startExample.html %}
{% capture example %}
```js
D("example.com", .... ,
AUTODNSSEC_ON, // Enable AutoDNSSEC.
@ -30,8 +29,9 @@ D("insecure.com", .... ,
A("@", "10.2.2.2")
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
If neither `AUTODNSSEC_ON` or `AUTODNSSEC_OFF` is specified for a
domain no changes will be requested.

View file

@ -42,13 +42,13 @@ Alias records can reference other record sets of the same type.
For example, a DNS CNAME record set can be an alias to another CNAME record set.
This arrangement is useful if you want some record sets to be aliases and some non-aliases.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider("AZURE_DNS"),
AZURE_ALIAS("foo", "A", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/trafficManagerProfiles/testpp2"), // record for traffic manager
AZURE_ALIAS("foo", "CNAME", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/dnszones/example.com/A/quux."), // record in the same zone
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -19,8 +19,7 @@ Flags are controlled by modifier:
CAA record is supported only by BIND, Google Cloud DNS, Amazon Route 53 and OVH. Some certificate authorities may not support this record until the mandatory date of September 2017.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
// Allow letsencrypt to issue certificate for this domain
@ -32,5 +31,6 @@ D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL)
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -25,12 +25,12 @@ only after sufficient time has elapsed to prove this is what you really want.
This example redirects the bare (aka apex, or naked) domain to www:
{% include startExample.html %}
{% capture example %}
```js
D("foo.com", .... ,
CF_REDIRECT("mydomain.com/*", "https://www.mydomain.com/$1"),
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -18,12 +18,12 @@ backups and manually verifying `dnscontrol preview` output before running
`dnscontrol push`. This is especially true when mixing Page Rules that are
managed by DNSControl and those that aren't.
{% include startExample.html %}
{% capture example %}
```js
D("foo.com", .... ,
CF_TEMP_REDIRECT("example.mydomain.com/*", "https://otherplace.yourdomain.com/$1"),
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -19,13 +19,13 @@ backups and manually verifying `dnscontrol preview` output before running
This example assigns the patterns `api.foo.com/*` and `foo.com/api/*` to a `my-worker` script:
{% include startExample.html %}
{% capture example %}
```js
D("foo.com", .... ,
CF_WORKER_ROUTE("api.foo.com/*", "my-worker"),
CF_WORKER_ROUTE("foo.com/api/*", "my-worker"),
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -11,8 +11,7 @@ Using `@` or `*` for CNAME records is not recommended, as different providers su
Target should be a string representing the CNAME target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider("R53"),
CNAME("foo", "google.com."), // foo.example.com -> google.com
@ -20,5 +19,6 @@ D("example.com", REGISTRAR, DnsProvider("R53"),
CNAME("def", "test"), // def.example.com -> test.example.com
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -19,12 +19,12 @@ Digest Type must be a number.
Digest must be a string.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider(R53),
DS("example.com", 2371, 13, 2, "ABCDEF")
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -7,8 +7,7 @@ parameters:
DefaultTTL sets the TTL for all records in a domain that do not explicitly set one with [TTL](#TTL). If neither `DefaultTTl` or `TTL` exist for a record,
it will use the DNSControl global default of 300 seconds.
{% include startExample.html %}
{% capture example %}
```js
D('example.com', REGISTRAR, DnsProvider('R53'),
DefaultTTL("4h"),
@ -19,5 +18,6 @@ D('example.com', REGISTRAR, DnsProvider('R53'),
The DefaultTTL duration is the same format as [TTL](#TTL), an integer number of seconds
or a string with a unit such as `'4d'`.
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -22,8 +22,7 @@ Technically `IGNORE_NAME` is a promise that DNSControl will not add, change, or
In this example, DNSControl will insert/update the "baz.example.com" record but will leave unchanged the "foo.example.com" and "bar.example.com" ones.
{% include startExample.html %}
{% capture example %}
```js
D("example.com",
`IGNORE_NAME`("foo"),
@ -31,8 +30,9 @@ D("example.com",
A("baz", "1.2.3.4")
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
`IGNORE_NAME` also supports glob patterns in the style of the [gobwas/glob](https://github.com/gobwas/glob) library. All of
the following patterns will work:

View file

@ -19,16 +19,16 @@ IGNORE_TARGET is generally used in very specific situations:
In this example, DNSControl will insert/update the "baz.example.com" record but will leave unchanged a CNAME to "foo.acm-validations.aws" record.
{% include startExample.html %}
{% capture example %}
```js
D("example.com",
IGNORE_TARGET('**.acm-validations.aws.', 'CNAME'),
A("baz", "1.2.3.4")
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
IGNORE_TARGET also supports glob patterns in the style of the [gobwas/glob](https://github.com/gobwas/glob#example) library. Some example patterns:

View file

@ -23,8 +23,7 @@ You wouldn't want to maintain bar.com manually, would you? It would
be very error prone. Therefore instead you maintain foo.com and
let `IMPORT_TRANSFORM` automatically generate bar.com.
{% include startExample.html %}
{% capture example %}
```text
foo.com:
one.foo.com. IN A 1.2.3.1
@ -39,13 +38,13 @@ bar.com:
three.foo.com.bar.com. IN A 123.123.123.113
four.foo.com.bar.com. IN A 123.123.123.114
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
Here's how you'd implement this in DNSControl:
{% include startExample.html %}
{% capture example %}
```js
var TRANSFORM_INT = [
// RANGE_START, RANGE_END, NEW_BASE
@ -65,8 +64,9 @@ D("bar.com", .... ,
IMPORT_TRANSFORM(TRANSFORM_INT, 'foo.com', 300),
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
Transform rules are: RANGE_START, RANGE_END, NEW_BASE. NEW_BASE may be:

View file

@ -7,8 +7,7 @@ parameters:
Includes all records from a given domain
{% include startExample.html %}
{% capture example %}
```js
D("example.com!external", REGISTRAR, DnsProvider(R53),
A("test", "8.8.8.8")
@ -19,5 +18,6 @@ D("example.com!internal", REGISTRAR, DnsProvider(R53),
A("home", "127.0.0.1")
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -13,13 +13,13 @@ Priority should be a number.
Target should be a string representing the MX target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider(R53),
MX("@", 5, "mail"), // mx example.com -> mail.example.com
MX("sub", 10, "mail.foo.com.")
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -17,8 +17,7 @@ delegations. `NAMESERVER()` is for informing upstream delegations.
For more information, refer to [this page]({{site.github.url}}/nameservers).
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, .... ,
DnsProvider(route53, 0),
@ -33,8 +32,9 @@ D("example2.com", REGISTRAR, .... ,
NAMESERVER("ns2.myserver.com."),
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
# The difference between NS() and NAMESERVER()

View file

@ -8,13 +8,13 @@ TTL sets the TTL on the domain apex NS RRs defined by [NAMESERVER](#NAMESERVER).
The value can be an integer or a string. See [TTL](#TTL) for examples.
{% include startExample.html %}
{% capture example %}
```js
D('example.com', REGISTRAR, DnsProvider('R53'),
NAMESERVER_TTL('2d'),
NAMESERVER('ns')
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -15,15 +15,15 @@ zone, but otherwise leave the zone alone. Changes to "foo"'s IP
address will update the record. Removing the A("foo", ...) record
from dnscontrol will leave the record in place.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", .... , NO_PURGE,
A("foo","1.2.3.4")
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
The main caveat of NO_PURGE is that intentionally deleting records
becomes more difficult. Suppose a NO_PURGE zone has an record such

View file

@ -14,8 +14,7 @@ The difference between `NS()` and `NAMESERVER()` is explained in the `NAMESERVER
Target should be a string representing the NS target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider("R53"),
NS("foo", "ns1.example2.com."), // Delegate ".foo.example.com" zone to another server.
@ -24,5 +23,6 @@ D("example.com", REGISTRAR, DnsProvider("R53"),
A("ns2.example2.com", "10.10.10.20"), // Glue records
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -56,8 +56,7 @@ and A, B, C are the first 3 octets of the IP address. For example
`172.20.18.130/27` is located in a zone named
`128/27.18.20.172.in-addr.arpa`
{% include startExample.html %}
{% capture example %}
```js
D(REV('1.2.3.0/24'), REGISTRAR, DnsProvider(BIND),
PTR('1', 'foo.example.com.'),
@ -78,8 +77,9 @@ D(REV('2001:db8:302::/48'), REGISTRAR, DnsProvider(BIND),
PTR('2001:db8:302::3', 'three.example.com.'), // '3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0'
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
In the future we plan on adding a flag to `A()` which will insert
the correct PTR() record if the appropriate `.arpa` domain has been

View file

@ -12,31 +12,30 @@ These three examples all are equivalent.
PURGE is the default:
{% include startExample.html %}
{% capture example %}
```js
D("example.com", .... ,
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
Purge is the default, but we set it anyway:
{% include startExample.html %}
{% capture example %}
```js
D("example.com", .... ,
PURGE,
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
Since the "last command wins", this is the same as `PURGE`:
{% include startExample.html %}
{% capture example %}
```js
D("example.com", .... ,
PURGE,
@ -46,5 +45,6 @@ D("example.com", .... ,
PURGE,
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -32,8 +32,7 @@ The zone id can be found depending on the target type:
* _S3 bucket_ (configured as website): specify the hosted zone ID for the region that you created the bucket in. You can find it in [the List of regions and hosted Zone IDs](http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region)
* _Another Route 53 record_: you can either specify the correct zone id or do not specify anything and dnscontrol will figure out the right zone id. (Note: Route53 alias can't reference a record in a different zone).
{% include startExample.html %}
{% capture example %}
```js
D('example.com', REGISTRAR, DnsProvider('ROUTE53'),
R53_ALIAS('foo', 'A', 'bar'), // record in same zone
@ -43,5 +42,6 @@ D('example.com', REGISTRAR, DnsProvider('ROUTE53'),
R53_ALIAS('foo', 'A', 'blahblah-bucket.s3-website-us-west-1.amazonaws.com.', R53_ZONE('Z2F56UZL2M1ACD')), // a website S3 Bucket in us-west-1
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -13,15 +13,15 @@ parameters:
`SOA` adds an `SOA` record to a domain. The name should be `@`. ns and mbox are strings. The other fields are unsigned 32-bit ints.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REG_THIRDPARTY, DnsProvider("DNS_BIND"),
SOA("@", "ns3.example.org.", "hostmaster.example.org.", 3600, 600, 604800, 1440),
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
## Notes:

View file

@ -13,8 +13,7 @@ parameters:
Priority, weight, and port are ints.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
// Create SRV records for a a SIP service:
@ -23,5 +22,6 @@ D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
SRV('_sip._tcp', 10, 20, 5060, 'smallbox1.example.tld.'),
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -28,10 +28,10 @@ SSHFP contains a fingerprint of a SSH server which can be validated before SSH c
`value` is the fingerprint as a string.
{% include startExample.html %}
{% capture example %}
```js
SSHFP('@', 1, 1, '00yourAmazingFingerprint00'),
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -15,13 +15,13 @@ Usage, selector, and type are ints.
Certificate is a hex string.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
// Create TLSA record for certificate used on TCP port 443
TLSA("_443._tcp", 3, 1, 1, "abcdef0"),
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -18,8 +18,7 @@ will be done for you.
Modifiers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.
{% include startExample.html %}
{% capture example %}
```js
D("example.com", REGISTRAR, ....,
TXT('@', '598611146-3338560'),
@ -30,8 +29,9 @@ Modifiers can be any number of [record modifiers](#record-modifiers) or json obj
TXT('long', 'X'.repeat(300)) // Long strings are split automatically.
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
NOTE: In the past, long strings had to be annotated with the keyword
`AUTOSPLIT`. This is no longer required. The keyword is now a no-op.

View file

@ -17,8 +17,7 @@ Modifier arguments are processed according to type as follows:
- An array argument will have all of it's members evaluated recursively. This allows you to combine multiple common records or modifiers into a variable that can
be used like a macro in multiple domains.
{% include startExample.html %}
{% capture example %}
```js
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var r53 = NewDnsProvider("R53","ROUTE53");
@ -44,8 +43,9 @@ D("example.com", REGISTRAR, DnsProvider(r53),
GOOGLE_APPS_DOMAIN_MX
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
# Split Horizon DNS
@ -58,8 +58,7 @@ To differentiate the different domains, specify the domains as
`domain.tld!tag`, such as `example.com!inside` and
`example.com!outside`.
{% include startExample.html %}
{% capture example %}
```js
var REG = NewRegistrar("Third-Party", "NONE");
var DNS_INSIDE = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI");
@ -77,8 +76,9 @@ D_EXTEND("example.com!inside",
A("internal", "10.99.99.99")
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
A domain name without a `!` is assigned a tag that is the empty
string. For example, `example.com` and `example.com!` are equivalent.

View file

@ -7,8 +7,7 @@ parameters:
`DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [D](#D) will have these
arguments passed as if they were the first modifiers in the argument list.
{% include startExample.html %}
{% capture example %}
```js
var COMMON = NewDnsProvider("foo","BIND");
// we want to create backup zone files for all domains, but not actually register them.
@ -21,5 +20,6 @@ D("example.com", REGISTRAR, DnsProvider("R53"), A("@","1.2.3.4")); // this domai
DEFAULTS();
D("example2.com", REGISTRAR, DnsProvider("R53"), A("@","1.2.3.4")); // this domain will not have the previous defaults.
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -31,8 +31,7 @@ in a `D_EXTEND` subdomain may not be what you expect.
Example:
{% include startExample.html %}
{% capture example %}
```js
D("domain.tld", REG, DnsProvider(DNS),
A("@", "127.0.0.1"), // domain.tld
@ -77,8 +76,9 @@ This will end up in the following modifications:
#11: CREATE CNAME g.sub.sub.domain.tld h.sub.sub.domain.tld.
#12: CREATE CNAME i.sub.domain.tld j.sub.domain.tld.
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
ProTips: `D_EXTEND()` permits you to create very complex and
sophisticated configurations, but you shouldn't. Be nice to the next

View file

@ -18,8 +18,7 @@ Otherwise the syntax of `FETCH` is the same as `fetch`.
> 1. Relying on external sources adds a point of failure. If the external source doesn't work, your script won't either. Please make sure you are aware of the consequences.
> 2. Make sure DnsControl only uses verified configuration if you want to use `FETCH`. For example, an attacker can send Pull Requests to your config repo, and have your CI test malicious configurations and make arbitrary HTTP requests. Therefore, `FETCH` must be explicitly enabled with flag `--allow-fetch` on DnsControl invocation.
{% include startExample.html %}
{% capture example %}
```js
var REG_NONE = NewRegistrar('none', 'NONE');
var DNS_BIND = NewDnsProvider('bind', 'BIND');
@ -42,5 +41,6 @@ FETCH('https://example.com', {
]);
});
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -8,12 +8,12 @@ Converts an IPv4 address from string to an integer. This allows performing mathe
This does not accept IPv6 addresses. (PRs gladly accepted.)
{% include startExample.html %}
{% capture example %}
```js
var addrA = IP('1.2.3.4')
var addrB = addrA + 1
// addrB = 1.2.3.5
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -14,13 +14,13 @@ Metadata is an optional object, that will only be used by certain providers. See
This function will return the name as a string so that you may assign it to a variable to use inside [D](#D) directives.
{% include startExample.html %}
{% capture example %}
```js
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var R53 = NewDnsProvider("r53", "ROUTE53");
D("example.com", REGISTRAR, DnsProvider(R53), A("@","1.2.3.4"));
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -14,13 +14,13 @@ Metadata is an optional object, that will only be used by certain providers. See
This function will return the name as a string so that you may assign it to a variable to use inside [D](#D) directives.
{% include startExample.html %}
{% capture example %}
```js
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var r53 = NewDnsProvider("R53","ROUTE53");
D("example.com", REGISTRAR, DnsProvider(r53), A("@","1.2.3.4"));
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -6,10 +6,10 @@ parameters:
`PANIC` terminates the script and therefore DnsControl with an exit code of 1. This should be used if your script cannot gather enough information to generate records, for example when a HTTP request failed.
{% include startExample.html %}
{% capture example %}
```js
PANIC("Something really bad has happened");
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -29,8 +29,7 @@ Note that the lower bits (the ones outside the netmask) must be zeros. They are
zeroed out automatically. Thus, `REV('1.2.3.4/24') is an error. This is done
to catch typos.
{% include startExample.html %}
{% capture example %}
```js
D(REV('1.2.3.0/24'), REGISTRAR, DnsProvider(BIND),
PTR("1", 'foo.example.com.'),
@ -47,8 +46,9 @@ D(REV('2001:db8:302::/48'), REGISTRAR, DnsProvider(BIND),
PTR("2001:db8:302::3", 'three.example.com.'), // 3.0.0...
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
In the future we plan on adding a flag to `A()` which will insert
the correct PTR() record if the appropriate `D(REV()` domain (i.e. `.arpa` domain) has been

View file

@ -11,8 +11,7 @@ configured at the time the function is called. Calling this function early or la
domains at the end of your configuration file.
Example for adding records to all configured domains:
{% include startExample.html %}
{% capture example %}
```js
var domains = getConfiguredDomains();
for(i = 0; i < domains.length; i++) {
@ -37,12 +36,12 @@ This will end up in following modifications:
#1: CREATE TXT _important.domain2.tld "BLA" ttl=43200
#2: REFRESH zone domain2.tld
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
Example for adding DMARC report records:
{% include startExample.html %}
This example might be more useful, specially for configuring the DMARC report records. According to DMARC RFC you need to specify `domain2.tld._report.dmarc.domain1.tld` to allow `domain2.tld` to send aggregate/forensic email reports to `domain1.tld`. This can be used to do this in an easy way, without using the wildcard from the RFC.
{% capture example %}This example might be more useful, specially for configuring the DMARC report records. According to DMARC RFC you need to specify `domain2.tld._report.dmarc.domain1.tld` to allow `domain2.tld` to send aggregate/forensic email reports to `domain1.tld`. This can be used to do this in an easy way, without using the wildcard from the RFC.
```js
var domains = getConfiguredDomains();
@ -64,5 +63,6 @@ This will end up in following modifications:
#3: CREATE TXT domain4.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200
#4: REFRESH zone domain2.tld
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -18,8 +18,7 @@ the currently-loading file (which may not be the file where the
is interpreted relative to the program's working directory at the time
of the call.
{% include startExample.html %}
{% capture example %}
```js
// dnsconfig.js
require('kubernetes/clusters.js');
@ -52,14 +51,14 @@ function includeK8Sdev() {
return [ /* ... */ ];
}
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
You can also use it to require json files and initialize variables with it:
For Example:
{% include startExample.html %}
{% capture example %}
```js
// dnsconfig.js
var domains = require('./domain-ip-map.json')
@ -78,8 +77,9 @@ for (var domain in domains) {
"myotherdomain.org": "5.5.5.5"
}
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}
# Future

View file

@ -22,8 +22,7 @@ The value can be:
* If no unit is specified, the default is seconds.
* We highly recommend using units instead of the number of seconds. Would your coworkers understand your intention better if you wrote `14400` or `'4h'`?
{% include startExample.html %}
{% capture example %}
```js
D('example.com', REGISTRAR, DnsProvider('R53'),
DefaultTTL(2000),
@ -33,5 +32,6 @@ D('example.com', REGISTRAR, DnsProvider('R53'),
A('demo2', '3.4.5.12', TTL('5w')), // 5 weeks
);
```
{% endcapture %}
{% include endExample.html %}
{% include example.html content=example %}

View file

@ -1,2 +0,0 @@
</div>

View file

@ -2,3 +2,5 @@
<span class='expand-arrow'><i class="fa fa-caret-right" aria-hidden="true"></i></span>
<span class='collapse-arrow'><i class="fa fa-caret-down" aria-hidden="true"></i></span></span>
<div class='collapse'>
{{ include.content | markdownify }}
</div>