mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Add R53_ZONE as an domain identifier (#1241)
Using R53_ZONE allows you to differentiate between split horizon domains across zones.
This commit is contained in:
@ -26,6 +26,10 @@ function initialize() {
|
||||
defaultArgs = [];
|
||||
}
|
||||
|
||||
function _isDomain(d) {
|
||||
return _.isArray(d.nameservers) && _.isArray(d.records) && _.isString(d.name);
|
||||
}
|
||||
|
||||
// Returns an array of domains which were registered so far during runtime
|
||||
// Own function for compatibility reasons or if some day special processing would be required.
|
||||
function getConfiguredDomains() {
|
||||
@ -276,8 +280,10 @@ var R53_ALIAS = recordBuilder('R53_ALIAS', {
|
||||
|
||||
// R53_ZONE(zone_id)
|
||||
function R53_ZONE(zone_id) {
|
||||
return function(r) {
|
||||
if (_.isObject(r.r53_alias)) {
|
||||
return function (r) {
|
||||
if (_isDomain(r)) {
|
||||
r.meta.zone_id = zone_id;
|
||||
} else if (_.isObject(r.r53_alias)) {
|
||||
r.r53_alias['zone_id'] = zone_id;
|
||||
} else {
|
||||
r.r53_alias = { zone_id: zone_id };
|
||||
|
7
pkg/js/parse_tests/040-r53-zone.js
Normal file
7
pkg/js/parse_tests/040-r53-zone.js
Normal file
@ -0,0 +1,7 @@
|
||||
D('foo.com', 'none', R53_ZONE('Z2FTEDLFRTZ'));
|
||||
D(
|
||||
'foo.com!internal',
|
||||
'none',
|
||||
R53_ZONE('Z2FTEDLFRTF'),
|
||||
R53_ALIAS('atest', 'A', 'foo.com.', R53_ZONE('Z2FTEDLFRTZ'))
|
||||
);
|
34
pkg/js/parse_tests/040-r53-zone.json
Normal file
34
pkg/js/parse_tests/040-r53-zone.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"registrars": [],
|
||||
"dns_providers": [],
|
||||
"domains": [
|
||||
{
|
||||
"name": "foo.com",
|
||||
"registrar": "none",
|
||||
"dnsProviders": {},
|
||||
"records": [],
|
||||
"meta": {
|
||||
"zone_id": "Z2FTEDLFRTZ"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "foo.com!internal",
|
||||
"registrar": "none",
|
||||
"dnsProviders": {},
|
||||
"records": [
|
||||
{
|
||||
"type": "R53_ALIAS",
|
||||
"name": "atest",
|
||||
"r53_alias": {
|
||||
"type": "A",
|
||||
"zone_id": "Z2FTEDLFRTZ"
|
||||
},
|
||||
"target": "foo.com."
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"zone_id": "Z2FTEDLFRTF"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user