fix REMOVE function bug
This commit is contained in:
parent
5445aec893
commit
4072ae0565
11
lib/index.js
11
lib/index.js
|
@ -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 =
|
||||
|
|
Loading…
Reference in New Issue