1
0
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:
Vincent Hagen
2021-09-02 22:54:54 +02:00
committed by GitHub
parent 3fa5712232
commit 8c5db2e11c
5 changed files with 108 additions and 24 deletions

View File

@ -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 };

View 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'))
);

View 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"
}
}
]
}