fix REMOVE function bug

This commit is contained in:
Aneem 2019-06-11 19:10:05 +05:45
parent 5445aec893
commit 4072ae0565
1 changed files with 5 additions and 6 deletions

View File

@ -114,20 +114,19 @@ module.exports.create = function(config) {
},
remove: function(data) {
var ch = data.challenge;
var zone = ch.identifier.value;
var dnsPrefix = ch.dnsHost.replace(new RegExp('.' + zone + '$'), '');
var txt = ch.dnsAuthorization;
var url = baseUrl + '/v2/domains/' + zone + '/records';
var domainRecord = ch.identifier.value;
// Digital ocean provides the api to remove records by ID. So we first get the recordId and use it to remove the domain record
return helpers.getDomain(domainRecord).then(function(zone) {
var dnsPrefix = ch.dnsHost.replace(new RegExp('.' + zone + '$'), '');
console.info('Removing TXT', data);
var payload = {
dnsPrefix: dnsPrefix,
zone: zone,
txt: data.dnsAuthorization
txt: ch.dnsAuthorization
};
return helpers.getTXTRecord(payload).then(function(txtRecord) {
if (txtRecord) {
var url =