github.com/StackExchange/dnscontrol/v4@v4.11.0/documentation/language-reference/top-level-functions/getConfiguredDomains.md (about) 1 --- 2 name: getConfiguredDomains 3 ts_is_function: true 4 ts_return: string[] 5 --- 6 7 `getConfiguredDomains` getConfiguredDomains is a helper function that returns the domain names 8 configured at the time the function is called. Calling this function early or later in 9 `dnsconfig.js` may return different results. Typical usage is to iterate over all 10 domains at the end of your configuration file. 11 12 Example for adding records to all configured domains: 13 {% code title="dnsconfig.js" %} 14 ```javascript 15 var domains = getConfiguredDomains(); 16 for(i = 0; i < domains.length; i++) { 17 D_EXTEND(domains[i], 18 TXT("_important", "BLA") // I know, not really creative. 19 ) 20 } 21 ``` 22 {% endcode %} 23 24 This will end up in following modifications: (All output assumes the `--full` flag) 25 26 27 ```text 28 ******************** Domain: domain1.tld 29 ----- Getting nameservers from: registrar 30 ----- DNS Provider: registrar...2 corrections 31 #1: CREATE TXT _important.domain1.tld "BLA" ttl=43200 32 #2: REFRESH zone domain1.tld 33 34 ******************** Domain: domain2.tld 35 ----- Getting nameservers from: registrar 36 ----- DNS Provider: registrar...2 corrections 37 #1: CREATE TXT _important.domain2.tld "BLA" ttl=43200 38 #2: REFRESH zone domain2.tld 39 ``` 40 41 Example for adding DMARC report records: 42 43 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. 44 45 {% code title="dnsconfig.js" %} 46 ```javascript 47 var domains = getConfiguredDomains(); 48 for(i = 0; i < domains.length; i++) { 49 D_EXTEND("domain1.tld", 50 TXT(domains[i] + "._report._dmarc", "v=DMARC1") 51 ); 52 } 53 ``` 54 {% endcode %} 55 56 This will end up in following modifications: 57 58 ```text 59 ******************** Domain: domain2.tld 60 ----- Getting nameservers from: registrar 61 ----- DNS Provider: registrar...4 corrections 62 #1: CREATE TXT domain1.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 63 #2: CREATE TXT domain3.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 64 #3: CREATE TXT domain4.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 65 #4: REFRESH zone domain2.tld 66 ```