Fixed api response, added propagation delay

Previous implementation did not work as api was not returning the response
This commit is contained in:
Anson Tsao 2020-10-22 14:25:38 -07:00
parent 97530da6bc
commit ae4bc64fa0
2 changed files with 10 additions and 4 deletions

View File

@ -17,7 +17,7 @@ First you create an instance with your API token:
```js
var dns01 = require('acme-dns-01-godaddy').create({
baseUrl: 'https://api.godaddy.com', // default
baseUrl: 'https://api.godaddy.com/v1', // default
key: 'xxxx',
secret: 'xxxx'
});

View File

@ -19,9 +19,11 @@ module.exports.create = function(config) {
var redacted = 'sso-key ' + apiKey + ':[redacted]';
return {
propagationDelay: 30*1000,
init: function(deps) {
request = deps.request;
return null;
return new Promise(resolve => resolve());
},
zones: function(data) {
@ -53,9 +55,9 @@ module.exports.create = function(config) {
return api('PATCH', '/domains/' + ch.dnsZone + '/records', records).then(
function(resp) {
return null;
return null
}
);
)
},
remove: function(data) {
var ch = data.challenge;
@ -66,6 +68,7 @@ module.exports.create = function(config) {
'/domains/' + ch.dnsZone + '/records/TXT/' + ch.dnsPrefix
)
.then(function(resp) {
// keep all TXT records that we don't need to remove
return resp.body.filter(function(el) {
return el.data !== ch.dnsAuthorization;
@ -93,6 +96,7 @@ module.exports.create = function(config) {
'/domains/' + ch.dnsZone + '/records/TXT',
records
).then(function(resp) {
return null;
});
});
@ -103,6 +107,7 @@ module.exports.create = function(config) {
'GET',
'/domains/' + ch.dnsZone + '/records/TXT/' + ch.dnsPrefix
).then(function(resp) {
var entry = (resp.body || []).filter(function(x) {
return x.data === ch.dnsAuthorization;
})[0];
@ -148,6 +153,7 @@ module.exports.create = function(config) {
'. Check subdomain, api key, etc'
);
}
return resp;
});
}
};