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) {
|
remove: function(data) {
|
||||||
var ch = data.challenge;
|
var ch = data.challenge;
|
||||||
var zone = ch.identifier.value;
|
var domainRecord = ch.identifier.value;
|
||||||
var dnsPrefix = ch.dnsHost.replace(new RegExp('.' + zone + '$'), '');
|
|
||||||
var txt = ch.dnsAuthorization;
|
|
||||||
var url = baseUrl + '/v2/domains/' + zone + '/records';
|
|
||||||
|
|
||||||
// Digital ocean provides the api to remove records by ID. So we first get the recordId and use it to remove the domain record
|
// 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) {
|
return helpers.getDomain(domainRecord).then(function(zone) {
|
||||||
var dnsPrefix = ch.dnsHost.replace(new RegExp('.' + zone + '$'), '');
|
var dnsPrefix = ch.dnsHost.replace(new RegExp('.' + zone + '$'), '');
|
||||||
|
|
||||||
|
console.info('Removing TXT', data);
|
||||||
var payload = {
|
var payload = {
|
||||||
dnsPrefix: dnsPrefix,
|
dnsPrefix: dnsPrefix,
|
||||||
zone: zone,
|
zone: zone,
|
||||||
txt: data.dnsAuthorization
|
txt: ch.dnsAuthorization
|
||||||
};
|
};
|
||||||
|
|
||||||
return helpers.getTXTRecord(payload).then(function(txtRecord) {
|
return helpers.getTXTRecord(payload).then(function(txtRecord) {
|
||||||
if (txtRecord) {
|
if (txtRecord) {
|
||||||
var url =
|
var url =
|
||||||
|
|
Loading…
Reference in New Issue