StackExchange / dnscontrol

Infrastructure as code for DNS!
https://dnscontrol.org/
MIT License
3.08k stars 390 forks source link

DOCS: Domain modifiers code examples #2967

Closed cafferata closed 3 months ago

cafferata commented 3 months ago

What do we expect from the Domain Modifiers code examples? Is a Top Level Functions D() included here or not? Currently they are used interchangeably.

Without D()

Domain modifier: CAA_BUILDER()

CAA_BUILDER({
  label: "@",
  iodef: "mailto:test@example.com",
  iodef_critical: true,
  issue: [
    "letsencrypt.org",
    "comodoca.com",
  ],
  issuewild: "none",
})

Domain modifier: SSHFP()

IGNORE(labelSpec, typeSpec, targetSpec):
IGNORE(labelSpec, typeSpec):
IGNORE(labelSpec):

With D()

Domain modifier: A()

D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
  A("@", "1.2.3.4"),
  A("foo", "2.3.4.5"),
  A("test.foo", IP("1.2.3.4"), TTL(5000)),
  A("*", "1.2.3.4", {foo: 42}),
END);
tlimoncelli commented 3 months ago

I think it is more friendly to beginners if we include the D() every time. One of my complaints about the Python docs is that they don't give context and new people (like I was years ago :-) ) get confused.

Likewise, the "record modifiers" examples should include D(... A(... record_modifier ))

cafferata commented 3 months ago

The scope has just been determined:

  1. documentation/language-reference/domain-modifiers/CAA_BUILDER.md
  2. documentation/language-reference/domain-modifiers/DMARC_BUILDER.md
  3. documentation/language-reference/domain-modifiers/IGNORE.md
  4. documentation/language-reference/domain-modifiers/M365_BUILDER.md
  5. documentation/language-reference/domain-modifiers/SSHFP.md