greenlock.js-ARCHIVED/backends/python.js

35 lines
926 B
JavaScript
Raw Normal View History

2015-12-13 05:03:48 +00:00
'use strict';
var PromiseA = require('bluebird');
var fs = PromiseA.promisifyAll(require('fs'));
2015-12-15 11:37:56 +00:00
module.exports.create = function (defaults, opts, extra) {
// v1.0.0 backwards compat
if (3 === arguments.length) {
opts.pythonClientPath = defaults;
defaults = opts;
opts = extra;
}
else if (2 !== arguments.length) {
throw new Error("Instead of creating the python backend yourself, just pass it to LE. See the README.md");
}
defaults.webroot = true;
2015-12-13 05:03:48 +00:00
defaults.renewByDefault = true;
2015-12-13 06:39:37 +00:00
defaults.text = true;
2015-12-13 05:03:48 +00:00
2015-12-15 05:21:59 +00:00
var leBinPath = defaults.pythonClientPath;
2015-12-13 05:03:48 +00:00
var LEP = require('letsencrypt-python');
var lep = PromiseA.promisifyAll(LEP.create(leBinPath, opts));
2015-12-13 05:03:48 +00:00
var wrapped = {
registerAsync: function (args) {
return lep.registerAsync('certonly', args);
}
, fetchAsync: function (args) {
2015-12-15 15:21:27 +00:00
require('./common').fetchFromDisk(args, defaults);
2015-12-13 05:03:48 +00:00
}
};
return wrapped;
};