fix webrootPath, updated README
This commit is contained in:
parent
81cfb1b010
commit
e8947cebbe
|
@ -11,15 +11,16 @@ module.exports.create = function (defaults) {
|
||||||
//
|
//
|
||||||
_challenges: {}
|
_challenges: {}
|
||||||
, setChallenge: function (args, key, value, cb) {
|
, 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) {
|
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?");
|
console.error("Try checking the permissions, maybe?");
|
||||||
cb(err);
|
cb(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var keyfile = path.join(defaults.webrootPath, key);
|
var keyfile = path.join(challengePath, key);
|
||||||
|
|
||||||
fs.writeFile(keyfile, value, 'utf8', function (err) {
|
fs.writeFile(keyfile, value, 'utf8', function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -35,7 +36,7 @@ module.exports.create = function (defaults) {
|
||||||
// handled as file read by web server
|
// handled as file read by web server
|
||||||
// , getChallenge: function (args, key, cb) {}
|
// , getChallenge: function (args, key, cb) {}
|
||||||
, removeChallenge: 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) {
|
fs.unlink(keyfile, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in New Issue