diff --git a/src/dns/caas.js b/src/dns/caas.js index 999d63613..647286231 100644 --- a/src/dns/caas.js +++ b/src/dns/caas.js @@ -30,7 +30,7 @@ function addSubdomain(zoneName, subdomain, type, value, callback) { var data = { type: type, - value: value + values: [ value ] }; superagent @@ -95,7 +95,7 @@ function delSubdomain(zoneName, subdomain, type, value, callback) { var data = { type: type, - value: value + values: [ value ] }; superagent diff --git a/src/dns/route53.js b/src/dns/route53.js index 84097e255..7a0d940b2 100644 --- a/src/dns/route53.js +++ b/src/dns/route53.js @@ -69,10 +69,14 @@ function addSubdomain(zoneName, subdomain, type, value, callback) { debug('addSubdomain: ' + subdomain + ' for domain ' + zoneName + ' with value ' + value); + var values = [ value ]; + getZoneByName(zoneName, function (error, zone) { if (error) return callback(error); var fqdn = config.appFqdn(subdomain); + var records = values.map(function (v) { return { Value: v }; }); + var params = { ChangeBatch: { Changes: [{ @@ -80,9 +84,7 @@ function addSubdomain(zoneName, subdomain, type, value, callback) { ResourceRecordSet: { Type: type, Name: fqdn, - ResourceRecords: [{ - Value: value - }], + ResourceRecords: records, Weight: 0, SetIdentifier: fqdn, TTL: 1 @@ -130,16 +132,18 @@ function delSubdomain(zoneName, subdomain, type, value, callback) { debug('delSubdomain: %s for domain %s.', subdomain, zoneName); + var values = [ value ]; + getZoneByName(zoneName, function (error, zone) { if (error) return callback(error); var fqdn = config.appFqdn(subdomain); + var records = values.map(function (v) { return { Value: v }; }); + var resourceRecordSet = { Name: fqdn, Type: type, - ResourceRecords: [{ - Value: value - }], + ResourceRecords: records, Weight: 0, SetIdentifier: fqdn, TTL: 1