This commit is contained in:
AJ ONeal 2015-12-16 11:43:30 +00:00
parent 4b6dff174e
commit 23b74e0609
4 changed files with 47 additions and 4 deletions

View File

@ -27,7 +27,49 @@ cli.parse({
, 'logs-dir': [ false, "(ignored)", 'string', '~/letsencrypt/var/log/' ] , 'logs-dir': [ false, "(ignored)", 'string', '~/letsencrypt/var/log/' ]
}); });
cli.main(function(args, options) { // ignore certonly and extraneous arguments
console.log(args); cli.main(function(_, options) {
console.log(options); var args = {};
var homedir = require('homedir')();
Object.keys(options).forEach(function (key) {
var val = options[key];
if ('string' === typeof val) {
val = val.replace(/^~/, homedir);
}
key = key.replace(/\-([a-z0-9A-Z])/g, function (c) { return c[1].toUpperCase(); });
args[key] = val;
});
Object.keys(args).forEach(function (key) {
var val = args[key];
if ('string' === typeof val) {
val = val.replace(/\:conf/, args.configDir);
}
args[key] = val;
});
var LE = require('letsencrypt');
var handlers;
if (args.standalone) {
handlers = require('../lib/standalone');
}
else if (args.webrootPath) {
handlers = require('../lib/webroot');
}
LE.create({}, handlers).register(args, function (err, results) {
if (err) {
console.error(err.stack);
return;
}
// should get back account, path to certs, pems, etc?
console.log(results);
});
}); });

0
lib/standalone.js Normal file
View File

0
lib/webroot.js Normal file
View File

View File

@ -33,6 +33,7 @@
}, },
"homepage": "https://github.com/Daplie/node-letsencrypt-cli", "homepage": "https://github.com/Daplie/node-letsencrypt-cli",
"dependencies": { "dependencies": {
"cli": "^0.11.1" "cli": "^0.11.1",
"homedir": "^0.6.0"
} }
} }