Fixed api response, added propagation delay
Previous implementation did not work as api was not returning the response
This commit is contained in:
parent
97530da6bc
commit
ae4bc64fa0
|
@ -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'
|
||||
});
|
||||
|
|
12
lib/index.js
12
lib/index.js
|
@ -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;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue