D_EXTEND
D_EXTEND
adds records (and metadata) to a domain previously defined by D()
. It can also be used to add subdomain records (and metadata) to a previously defined domain.
The first argument is a domain name. If it exactly matches a previously defined domain, D_EXTEND()
behaves the same as D()
, simply adding records as if they had been specified in the original D()
.
If the domain name does not match an existing domain, but could be a (non-delegated) subdomain of an existing domain, the new records (and metadata) are added with the subdomain part appended to all record names (labels), and targets (as appropriate). See the examples below.
Matching the domain name to previously-defined domains is done using a longest match
algorithm. If domain.tld
and sub.domain.tld
are defined as separate domains via separate D()
statements, then D_EXTEND("sub.sub.domain.tld", ...)
would match sub.domain.tld
, not domain.tld
.
Some operators only act on an apex domain (e.g. CF_SINGLE_REDIRECT
, CF_REDIRECT
, and CF_TEMP_REDIRECT
). Using them in a D_EXTEND
subdomain may not be what you expect.
This will end up in the following modifications: (This output assumes the --full
flag)
ProTips: D_EXTEND()
permits you to create very complex and sophisticated configurations, but you shouldn't. Be nice to the next person that edits the file, who may not be as expert as yourself. Enhance readability by putting any D_EXTEND()
statements immediately after the original D()
, like in above example. Avoid the temptation to obscure the addition of records to existing domains with randomly placed D_EXTEND()
statements. Don't build up a domain using loops of D_EXTEND()
statements. You'll be glad you didn't.
Last updated