mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
NEW: require() now supports loading JSON too (#474)
This commit is contained in:
committed by
Tom Limoncelli
parent
7ed3adb2f1
commit
608dd7af56
@ -14,7 +14,7 @@ to split your configuration across multiple files. If the path starts with a
|
||||
// dnsconfig.js
|
||||
require('kubernetes/clusters.js');
|
||||
|
||||
D("mydomain.net", REG, PROVIDER,
|
||||
D("mydomain.net", REG, PROVIDER,
|
||||
IncludeKubernetes()
|
||||
);
|
||||
|
||||
@ -50,3 +50,29 @@ function includeK8Sdev() {
|
||||
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
||||
|
||||
You can also use it to require json files and initialize variables with it:
|
||||
For Example:
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
|
||||
// dnsconfig.js
|
||||
var domains = require('./domain-ip-map.json')
|
||||
|
||||
for (var domain in domains) {
|
||||
D(domain, REG, PROVIDER,
|
||||
A("@", domains[domain])
|
||||
);
|
||||
}
|
||||
|
||||
{%endhighlight%}
|
||||
|
||||
{%highlight js %}
|
||||
// domain-ip-map.json
|
||||
{
|
||||
"mydomain.net": "1.1.1.1",
|
||||
"myotherdomain.org": "5.5.5.5"
|
||||
}
|
||||
{%endhighlight}
|
||||
{% include endExample.html %}
|
Reference in New Issue
Block a user