2017-01-11 13:02:45 -07:00
|
|
|
---
|
|
|
|
name: DEFAULTS
|
|
|
|
parameters:
|
|
|
|
- modifiers...
|
2023-01-12 16:59:42 -05:00
|
|
|
parameter_types:
|
2023-02-13 14:13:27 -05:00
|
|
|
"modifiers...": DomainModifier[]
|
2017-01-11 13:02:45 -07:00
|
|
|
---
|
|
|
|
|
2023-01-21 23:26:35 +01:00
|
|
|
`DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [`D`](D.md) will have these
|
2017-01-11 13:02:45 -07:00
|
|
|
arguments passed as if they were the first modifiers in the argument list.
|
|
|
|
|
2023-01-21 23:26:35 +01:00
|
|
|
## Example
|
|
|
|
|
|
|
|
We want to create backup zone files for all domains, but not actually register them. Also create a [`DefaultTTL`](../domain/DefaultTTL.md).
|
|
|
|
The domain `example.com` will have the defaults set.
|
|
|
|
|
2023-03-13 21:30:21 +01:00
|
|
|
{% code title="dnsconfig.js" %}
|
2023-01-20 13:56:20 +01:00
|
|
|
```javascript
|
2022-05-08 14:23:45 -04:00
|
|
|
var COMMON = NewDnsProvider("foo");
|
2023-01-21 23:26:35 +01:00
|
|
|
DEFAULTS(
|
|
|
|
DnsProvider(COMMON, 0),
|
2023-05-24 22:09:22 +02:00
|
|
|
DefaultTTL("1d")
|
2023-01-21 23:26:35 +01:00
|
|
|
);
|
|
|
|
|
2023-06-18 05:35:13 +02:00
|
|
|
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
2023-01-21 23:26:35 +01:00
|
|
|
A("@","1.2.3.4")
|
|
|
|
);
|
|
|
|
```
|
2023-03-13 21:30:21 +01:00
|
|
|
{% endcode %}
|
2017-01-11 13:02:45 -07:00
|
|
|
|
2023-01-21 23:26:35 +01:00
|
|
|
If you want to clear the defaults, you can do the following.
|
|
|
|
The domain `example2.com` will **not** have the defaults set.
|
2017-01-11 13:02:45 -07:00
|
|
|
|
2023-03-13 21:30:21 +01:00
|
|
|
{% code title="dnsconfig.js" %}
|
2023-01-21 23:26:35 +01:00
|
|
|
```javascript
|
2017-01-11 13:02:45 -07:00
|
|
|
DEFAULTS();
|
2023-01-21 23:26:35 +01:00
|
|
|
|
2023-06-18 05:35:13 +02:00
|
|
|
D("example2.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
2023-01-21 23:26:35 +01:00
|
|
|
A("@","1.2.3.4")
|
|
|
|
);
|
2022-02-17 18:22:31 +01:00
|
|
|
```
|
2023-03-13 21:30:21 +01:00
|
|
|
{% endcode %}
|