fix webrootPath, updated README

This commit is contained in:
AJ ONeal 2015-12-19 20:50:02 +00:00
parent 81cfb1b010
commit e8947cebbe
1 changed files with 5 additions and 4 deletions

View File

@ -11,15 +11,16 @@ module.exports.create = function (defaults) {
//
_challenges: {}
, setChallenge: function (args, key, value, cb) {
mkdirp(defaults.webrootPath, function (err) {
var challengePath = path.join(defaults.webrootPath, '.well-known', 'acme-challenge');
mkdirp(challengePath, function (err) {
if (err) {
console.error("Could not create --webroot-path '" + defaults.webrootPath + "':", err.code);
console.error("Could not create --webroot-path '" + challengePath + "':", err.code);
console.error("Try checking the permissions, maybe?");
cb(err);
return;
}
var keyfile = path.join(defaults.webrootPath, key);
var keyfile = path.join(challengePath, key);
fs.writeFile(keyfile, value, 'utf8', function (err) {
if (err) {
@ -35,7 +36,7 @@ module.exports.create = function (defaults) {
// handled as file read by web server
// , getChallenge: function (args, key, cb) {}
, removeChallenge: function (args, key, cb) {
var keyfile = path.join(defaults.webrootPath, key);
var keyfile = path.join(defaults.webrootPath, '.well-known', 'acme-challenge', key);
fs.unlink(keyfile, function (err) {
if (err) {