Fixed api response, added propagation delay #4

Closed
Ghost wants to merge 1 commits from (deleted):ansont/fix-resp-propagationDelay into master
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;
});
}
};