add wait option to template

This commit is contained in:
AJ ONeal 2019-07-31 16:33:12 -06:00
parent 560f0eddef
commit 472b89f193
1 changed files with 15 additions and 3 deletions

View File

@ -1,9 +1,13 @@
'use strict';
var request;
var defaults = {};
var defaults = {
wait: 15 * 1000
};
module.exports.create = function(config) {
var wait = config.wait || defaults.wait;
return {
init: function(opts) {
request = opts.request;
@ -14,14 +18,22 @@ module.exports.create = function(config) {
throw Error('listing zones not implemented');
},
set: function(data) {
// console.info('Add TXT', data);
var ch = data.challenge;
if (!ch.dnsZone) {
// zones() is not implemented for http-01 challenges,
// but it is almost always implemented for dns-01 challenges
// but it is almost always implemented for dns-01 challenges.
// Any plugin that implements zones() should expect ch.dnsZone here
throw new Error('No matching zone for ' + ch.dnsHost);
}
// console.info('Add TXT', data);
throw Error('setting TXT not implemented');
// many APIs return a valid response quite a bit
// before they actually set the record, and checking
// too quickly will self-poison the response cache.
return new Promise(function(resolve) {
setTimeout(resolve, wait, null);
});
},
remove: function(data) {
// console.info('Remove TXT', data);