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
|
```js
|
||||||
var dns01 = require('acme-dns-01-godaddy').create({
|
var dns01 = require('acme-dns-01-godaddy').create({
|
||||||
baseUrl: 'https://api.godaddy.com', // default
|
baseUrl: 'https://api.godaddy.com/v1', // default
|
||||||
key: 'xxxx',
|
key: 'xxxx',
|
||||||
secret: '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]';
|
var redacted = 'sso-key ' + apiKey + ':[redacted]';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
propagationDelay: 30*1000,
|
||||||
|
|
||||||
init: function(deps) {
|
init: function(deps) {
|
||||||
request = deps.request;
|
request = deps.request;
|
||||||
return null;
|
return new Promise(resolve => resolve());
|
||||||
},
|
},
|
||||||
|
|
||||||
zones: function(data) {
|
zones: function(data) {
|
||||||
|
@ -53,9 +55,9 @@ module.exports.create = function(config) {
|
||||||
|
|
||||||
return api('PATCH', '/domains/' + ch.dnsZone + '/records', records).then(
|
return api('PATCH', '/domains/' + ch.dnsZone + '/records', records).then(
|
||||||
function(resp) {
|
function(resp) {
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
},
|
},
|
||||||
remove: function(data) {
|
remove: function(data) {
|
||||||
var ch = data.challenge;
|
var ch = data.challenge;
|
||||||
|
@ -66,6 +68,7 @@ module.exports.create = function(config) {
|
||||||
'/domains/' + ch.dnsZone + '/records/TXT/' + ch.dnsPrefix
|
'/domains/' + ch.dnsZone + '/records/TXT/' + ch.dnsPrefix
|
||||||
)
|
)
|
||||||
.then(function(resp) {
|
.then(function(resp) {
|
||||||
|
|
||||||
// keep all TXT records that we don't need to remove
|
// keep all TXT records that we don't need to remove
|
||||||
return resp.body.filter(function(el) {
|
return resp.body.filter(function(el) {
|
||||||
return el.data !== ch.dnsAuthorization;
|
return el.data !== ch.dnsAuthorization;
|
||||||
|
@ -93,6 +96,7 @@ module.exports.create = function(config) {
|
||||||
'/domains/' + ch.dnsZone + '/records/TXT',
|
'/domains/' + ch.dnsZone + '/records/TXT',
|
||||||
records
|
records
|
||||||
).then(function(resp) {
|
).then(function(resp) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -103,6 +107,7 @@ module.exports.create = function(config) {
|
||||||
'GET',
|
'GET',
|
||||||
'/domains/' + ch.dnsZone + '/records/TXT/' + ch.dnsPrefix
|
'/domains/' + ch.dnsZone + '/records/TXT/' + ch.dnsPrefix
|
||||||
).then(function(resp) {
|
).then(function(resp) {
|
||||||
|
|
||||||
var entry = (resp.body || []).filter(function(x) {
|
var entry = (resp.body || []).filter(function(x) {
|
||||||
return x.data === ch.dnsAuthorization;
|
return x.data === ch.dnsAuthorization;
|
||||||
})[0];
|
})[0];
|
||||||
|
@ -148,6 +153,7 @@ module.exports.create = function(config) {
|
||||||
'. Check subdomain, api key, etc'
|
'. Check subdomain, api key, etc'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return resp;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue