updates
This commit is contained in:
parent
d4a44f893c
commit
1ad3e6f2f2
|
@ -3,7 +3,7 @@
|
|||
var PromiseA = require('bluebird');
|
||||
var path = require('path');
|
||||
var fs = PromiseA.promisifyAll(require('fs'));
|
||||
var cutils = PromiseA.promisifyAll(require('crypto-utils-ursa'));
|
||||
var cutils = PromiseA.promisifyAll(require('../lib/crypto-utils-ursa'));
|
||||
//var futils = require('letsencrypt-forge/lib/crypto-utils');
|
||||
var requestAsync = PromiseA.promisify(require('request'));
|
||||
var lef = PromiseA.promisifyAll(require('letsencrypt-forge'));
|
||||
|
|
4
index.js
4
index.js
|
@ -44,14 +44,14 @@ LE.create = function (backend, defaults, handlers) {
|
|||
// GET /.well-known/acme-challenge/{{challengeKey}} should return {{tokenValue}}
|
||||
throw new Error("handlers.setChallenge or defaults.webrootPath must be set");
|
||||
}
|
||||
handlers.setChallenge = require('lib/default-set-challenge');
|
||||
handlers.setChallenge = require('./lib/default-handlers').setChallenge;
|
||||
}
|
||||
if (!handlers.removeChallenge) {
|
||||
if (!defaults.webrootPath) {
|
||||
// GET /.well-known/acme-challenge/{{challengeKey}} should return {{tokenValue}}
|
||||
throw new Error("handlers.setChallenge or defaults.webrootPath must be set");
|
||||
}
|
||||
handlers.removeChallenge = require('lib/default-remove-challenge');
|
||||
handlers.removeChallenge = require('./lib/default-handlers').remove-Challenge;
|
||||
}
|
||||
if (!handlers.agreeToTerms) {
|
||||
if (defaults.agreeTos) {
|
||||
|
|
|
@ -1,5 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
module.exports.agreeToTerms = function (args, agree) {
|
||||
agree(args.agreeTos || args.agree);
|
||||
agree(args.agreeTos);
|
||||
};
|
||||
|
||||
module.exports.setChallenge = function (args, challengePath, keyAuthorization, done) {
|
||||
//var hostname = args.domains[0];
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
// TODO should be args.webrootPath
|
||||
mkdirp(path.join(args.webrootPath, challengePath), function (err) {
|
||||
if (err) {
|
||||
done(err);
|
||||
return;
|
||||
}
|
||||
|
||||
fs.writeFile(path.join(args.webrootPath, challengePath), keyAuthorization, 'utf8', function (err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.getChallenge = function (args, key, done) {
|
||||
//var hostname = args.domains[0];
|
||||
|
||||
fs.readFile(path.join(args.webroot, key), 'utf8', done);
|
||||
};
|
||||
|
||||
module.exports.removeChallenge = function (args, key, done) {
|
||||
//var hostname = args.domains[0];
|
||||
|
||||
fs.unlinkSync(path.join(args.webroot, key), done);
|
||||
};
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = function (args, key, done) {
|
||||
//var hostname = args.domains[0];
|
||||
|
||||
fs.unlinkSync(path.join(args.webroot, key), done);
|
||||
};
|
|
@ -1,21 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function (args, challengePath, keyAuthorization, done) {
|
||||
//var hostname = args.domains[0];
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
// TODO should be args.webrootPath
|
||||
mkdirp(path.join(args.webrootPath, challengePath), function (err) {
|
||||
if (err) {
|
||||
done(err);
|
||||
return;
|
||||
}
|
||||
|
||||
fs.writeFile(path.join(args.webrootPath, challengePath), keyAuthorization, 'utf8', function (err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
};
|
|
@ -43,7 +43,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"bluebird": "^3.0.6",
|
||||
"mkdirp": "^0.5.1",
|
||||
"pyconf": "^1.0.0",
|
||||
"request": "^2.67.0",
|
||||
"safe-replace": "^1.0.0",
|
||||
"serve-static": "^1.10.0"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue