Skip to content

Commit

Permalink
DOCS: Improve consistency in code examples in language reference (#2439)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Limoncelli <[email protected]>
  • Loading branch information
cafferata and TomOnTime authored Jun 17, 2023
1 parent 0bf24d0 commit 7977a7b
Show file tree
Hide file tree
Showing 58 changed files with 115 additions and 115 deletions.
2 changes: 1 addition & 1 deletion documentation/cli-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if (view == "external") {

/// ...much later...

D("example.org", REG_NAMECOM, DnsProvider(DNS_NAMECOM), DnsProvider(DNS_BIND),
D("example.com", REG_NAMECOM, DnsProvider(DNS_NAMECOM), DnsProvider(DNS_BIND),
A("sitea", host01, TTL(1800)),
A("siteb", host01, TTL(1800)),
A("sitec", host02, TTL(1800)),
Expand Down
6 changes: 3 additions & 3 deletions documentation/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
```javascript
var mailTTL = TTL("1h");

D("example.com", registrar,
D("example.com", REG_MY_PROVIDER,
NAMESERVER_TTL("10m"), // On domain apex NS RRs
DefaultTTL("5m"), // Default for a domain

Expand Down Expand Up @@ -107,9 +107,9 @@ D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_R53),
## Use SPF_BUILDER to add comments to SPF records ##
{% code title="dnsconfig.js" %}
```javascript
D("example.tld", REG_MY_PROVIDER, DSP, ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
A("@", "10.2.2.2"),
MX("@", "example.tld."),
MX("@", "example.com."),
SPF_BUILDER({
label: "@",
overflow: "_spf%d",
Expand Down
2 changes: 1 addition & 1 deletion documentation/functions/domain/CF_REDIRECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This example redirects the bare (aka apex, or naked) domain to www:
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
CF_REDIRECT("mydomain.com/*", "https://www.mydomain.com/$1"),
CF_REDIRECT("example.com/*", "https://www.example.com/$1"),
);
```
{% endcode %}
2 changes: 1 addition & 1 deletion documentation/functions/domain/CF_TEMP_REDIRECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ managed by DNSControl and those that aren't.
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
CF_TEMP_REDIRECT("example.mydomain.com/*", "https://otherplace.yourdomain.com/$1"),
CF_TEMP_REDIRECT("example.example.com/*", "https://otherplace.yourdomain.com/$1"),
);
```
{% endcode %}
4 changes: 2 additions & 2 deletions documentation/functions/domain/DISABLE_IGNORE_SAFETY_CHECK.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ See [`IGNORE()`](../domain/IGNORE.md) for more information.

## Syntax

```
D("example.com", ...
```javascript
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
DISABLE_IGNORE_SAFETY_CHECK,
...
TXT("myhost", "mytext"),
Expand Down
12 changes: 6 additions & 6 deletions documentation/functions/domain/IGNORE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ General examples:

{% code title="dnsconfig.js" %}
```javascript
D("example.com", ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
IGNORE("foo"), // matches any records on foo.example.com
IGNORE("baz", "A"), // matches any A records on label baz.example.com
IGNORE("*", "MX", "*"), // matches all MX records
Expand All @@ -86,7 +86,7 @@ Ignore Let's Encrypt (ACME) validation records:

{% code title="dnsconfig.js" %}
```javascript
D("example.com", ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
IGNORE("_acme-challenge", "TXT"),
IGNORE("_acme-challenge.**", "TXT"),
END);
Expand All @@ -97,7 +97,7 @@ Ignore DNS records typically inserted by Microsoft ActiveDirectory:

{% code title="dnsconfig.js" %}
```javascript
D("example.com", ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
IGNORE("_gc", "SRV"), // General Catalog
IGNORE("_gc.**", "SRV"), // General Catalog
IGNORE("_kerberos", "SRV"), // Kerb5 server
Expand Down Expand Up @@ -128,7 +128,7 @@ using DNSControl notation for the records. Pretend some other system inserted th

{% code title="dnsconfig.js" %}
```javascript
D("example.com", ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
A("@", "151.101.1.69"),
A("www", "151.101.1.69"),
A("foo", "1.1.1.1"),
Expand Down Expand Up @@ -261,7 +261,7 @@ This will generate an error:

{% code title="dnsconfig.js" %}
```javascript
D("example.com", ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
...
TXT("myhost", "mytext"),
IGNORE("myhost", "*", "*"), // Error! Ignoring an item we inserted
Expand All @@ -274,7 +274,7 @@ to the `D()`.
{% code title="dnsconfig.js" %}
```javascript
D("example.com", ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
DISABLE_IGNORE_SAFETY_CHECK,
...
TXT("myhost", "mytext"),
Expand Down
2 changes: 1 addition & 1 deletion documentation/functions/domain/LOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The coordinate format for `LOC()` is:

{% code title="dnsconfig.js" %}
```javascript
D("example.com","none"
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
// LOC "subdomain", d1, m1, s1, "[NnSs]", d2, m2, s2, "[EeWw]", alt, siz, hp, vp)
//42 21 54 N 71 06 18 W -24m 30m
, LOC("@", 42, 21, 54, "N", 71, 6, 18, "W", -24, 30, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion documentation/functions/domain/NAMESERVER.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ It looks like this:
{% code title="dnsconfig.js" %}
```javascript
var REG_THIRDPARTY = NewRegistrar("ThirdParty");
D("mydomain.com", REG_THIRDPARTY,
D("example.com", REG_THIRDPARTY,
...
)
```
Expand Down
2 changes: 1 addition & 1 deletion documentation/functions/domain/SOA.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ parameter_types:
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REG_MY_PROVIDER, DnsProvider("DNS_BIND"),
SOA("@", "ns3.example.org.", "hostmaster@example.org", 3600, 600, 604800, 1440),
SOA("@", "ns3.example.com.", "hostmaster@example.com", 3600, 600, 604800, 1440),
);
```
{% endcode %}
Expand Down
4 changes: 2 additions & 2 deletions documentation/functions/domain/SRV.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Priority, weight, and port are ints.
D("example.com", REG_MY_PROVIDER, DnsProvider("GCLOUD"),
// Create SRV records for a a SIP service:
// pr w port, target
SRV("_sip._tcp", 10, 60, 5060, "bigbox.example.tld."),
SRV("_sip._tcp", 10, 20, 5060, "smallbox1.example.tld."),
SRV("_sip._tcp", 10, 60, 5060, "bigbox.example.com."),
SRV("_sip._tcp", 10, 20, 5060, "smallbox1.example.com."),
);
```
{% endcode %}
2 changes: 1 addition & 1 deletion documentation/functions/global/D.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var GOOGLE_APPS_DOMAIN_MX = [
MX("@", 10, "alt4.aspmx.l.google.com."),
]

D("example.com", REGISTRAR, DnsProvider(r53),
D("example.com", REG_MY_PROVIDER, DnsProvider(r53),
A("@","1.2.3.4"),
CNAME("test", "foo.example2.com."),
GOOGLE_APPS_DOMAIN_MX
Expand Down
6 changes: 3 additions & 3 deletions documentation/functions/global/require.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ of the call.
```javascript
require("kubernetes/clusters.js");

D("mydomain.net", REG_MY_PROVIDER, PROVIDER,
D("example.com", REG_MY_PROVIDER, PROVIDER,
IncludeKubernetes()
);
```
Expand Down Expand Up @@ -77,8 +77,8 @@ for (var domain in domains) {
{% code title="domain-ip-map.json" %}
```javascript
{
"mydomain.net": "1.1.1.1",
"myotherdomain.org": "5.5.5.5"
"example.com": "1.1.1.1",
"other-example.com``": "5.5.5.5"
}
```
{% endcode %}
Expand Down
4 changes: 2 additions & 2 deletions documentation/functions/record/CAA_BUILDER.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For example you can use:
```javascript
CAA_BUILDER({
label: "@",
iodef: "mailto:test@domain.tld",
iodef: "mailto:test@example.com",
iodef_critical: true,
issue: [
"letsencrypt.org",
Expand All @@ -51,7 +51,7 @@ The parameters are:

{% code title="dnsconfig.js" %}
```javascript
CAA("@", "iodef", "mailto:test@domain.tld", CAA_CRITICAL)
CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL)
CAA("@", "issue", "letsencrypt.org")
CAA("@", "issue", "comodoca.com")
CAA("@", "issuewild", ";")
Expand Down
4 changes: 2 additions & 2 deletions documentation/functions/record/LOC_BUILDER_DD.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ The White House:

{% code title="dnsconfig.js" %}
```javascript
D("example.com","none"
, LOC_BUILDER_DD({
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
LOC_BUILDER_DD({
label: "big-ben",
x: 51.50084265331501,
y: -0.12462541415599787,
Expand Down
2 changes: 1 addition & 1 deletion documentation/functions/record/LOC_BUILDER_DMM_STR.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Note that the following are acceptable forms (symbols differ):

{% code title="dnsconfig.js" %}
```javascript
D("example.com","none"
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
LOC_BUILDER_STR({
label: "tasmania",
str: "42°S 147°E",
Expand Down
2 changes: 1 addition & 1 deletion documentation/functions/record/LOC_BUILDER_DMS_STR.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Note that the following are acceptable forms (symbols differ):

{% code title="dnsconfig.js" %}
```javascript
D("example.com","none"
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
LOC_BUILDER_DMS_STR({
label: "sydney-opera-house",
str: "33°51′31″S 151°12′51″E",
Expand Down
2 changes: 1 addition & 1 deletion documentation/functions/record/LOC_BUILDER_STR.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Accepts a string and tries all `LOC_BUILDER_DM*_STR({})` methods:

{% code title="dnsconfig.js" %}
```javascript
D("example.com","none"
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
, LOC_BUILDER_STR({
label: "old-faithful",
str: "44.46046°N 110.82815°W",
Expand Down
12 changes: 6 additions & 6 deletions documentation/functions/record/SPF_BUILDER.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Here is an example of how SPF settings are normally done:

{% code title="dnsconfig.js" %}
```javascript
D("example.tld", REG_MY_PROVIDER, DNS, ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
TXT("v=spf1 ip4:198.252.206.0/24 ip4:192.111.0.0/24 include:_spf.google.com include:mailgun.org include:spf-basic.fogcreek.com include:mail.zendesk.com include:servers.mcsv.net include:sendgrid.net include:450622.spf05.hubspotemail.net ~all")
)
```
Expand All @@ -55,9 +55,9 @@ This has a few problems:

{% code title="dnsconfig.js" %}
```javascript
D("example.tld", REG_MY_PROVIDER, DSP, ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
A("@", "10.2.2.2"),
MX("@", "example.tld."),
MX("@", "example.com."),
SPF_BUILDER({
label: "@",
overflow: "_spf%d",
Expand Down Expand Up @@ -98,7 +98,7 @@ When you want to specify SPF settings for a domain, use the

{% code title="dnsconfig.js" %}
```javascript
D("example.tld", REG_MY_PROVIDER, DSP, ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
...
...
...
Expand Down Expand Up @@ -305,11 +305,11 @@ var SPF_MYSETTINGS = SPF_BUILDER({
]
});

D("example.tld", REG_MY_PROVIDER, DSP, ...
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
SPF_MYSETTINGS
);

D("example2.tld", REG_MY_PROVIDER, DSP, ...
D("example2.tld", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
SPF_MYSETTINGS
);
```
Expand Down
2 changes: 1 addition & 1 deletion documentation/functions/record/TTL.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The value can be:

{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("R53"),
D("example.com", REG_MY_PROVIDER, DnsProvider("R53"),
DefaultTTL(2000),
A("@","1.2.3.4"), // uses default
A("foo", "2.3.4.5", TTL(500)), // overrides default
Expand Down
2 changes: 1 addition & 1 deletion documentation/get-zones.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Read a zonefile, generate a JS file, then use the JS file to see how
different it is from the zonefile:
```shell
dnscontrol get-zone --format=djs -out=foo.djs bind - example.org
dnscontrol get-zone --format=djs -out=foo.djs bind - example.com
dnscontrol preview --config foo.js
```
Expand Down
Loading

0 comments on commit 7977a7b

Please sign in to comment.