diff --git a/bin/letsencrypt.js b/bin/letsencrypt.js index 356b21a..91324eb 100755 --- a/bin/letsencrypt.js +++ b/bin/letsencrypt.js @@ -58,6 +58,12 @@ cli.main(function(_, options) { args.domains = args.domains.split(','); } + if (!(Array.isArray(args.domains) && args.domains.length) || !args.email || !args.agreeTos) { + console.error("\nUsage: letsencrypt certonly --standalone --domains example.com --email user@example.com --agree-tos"); + console.error("\nSee letsencrypt --help for more details\n"); + return; + } + if (args.tlsSni01Port) { args.tlsSni01Port = args.tlsSni01Port.split(',').map(function (port) { return parseInt(port, 10); @@ -89,7 +95,15 @@ cli.main(function(_, options) { } // let LE know that we're handling standalone / webroot here - LE.create({ manual: true }, handlers).register(args, function (err, results) { + LE.create({ + manual: true + , debug: args.debug + , configDir: args.configDir + , privkeyPath: ':conf/live/:hostname/privkey.pem' //args.privkeyPath + , fullchainPath: args.fullchainPath + , certPath: args.certPath + , chainPath: args.chainPath + }, handlers).register(args, function (err, results) { if (err) { console.error('[Error]: letsencrypt'); console.error(err); @@ -101,8 +115,14 @@ cli.main(function(_, options) { } // should get back account, path to certs, pems, etc? - console.log('results'); - console.log(results); + console.log('\nCertificates installed at:'); + console.log(Object.keys(results).filter(function (key) { + return /Path/.test(key); + }).map(function (key) { + return results[key]; + }).join('\n')); + + process.exit(0); }); }); }); diff --git a/lib/standalone.js b/lib/standalone.js index 5982c38..8bbbf68 100644 --- a/lib/standalone.js +++ b/lib/standalone.js @@ -38,7 +38,8 @@ module.exports.create = function () { res.end(val || '_'); }); } - , startServers: function (plainPorts, tlsPorts) { + , startServers: function (plainPorts, tlsPorts, opts) { + opts = opts || {}; var httpsOptions = require('localhost.daplie.com-certificates'); var https = require('https'); var http = require('http'); @@ -50,12 +51,16 @@ module.exports.create = function () { plainPorts.forEach(function (port) { http.createServer(handlers.httpResponder).listen(port, function () { - console.info('Listening http on', this.address()); + if (opts.debug) { + console.info('Listening http on', this.address()); + } }); }); tlsPorts.forEach(function (port) { https.createServer(httpsOptions, handlers.httpResponder).listen(port, function () { - console.info('Listening https on', this.address()); + if (opts.debug) { + console.info('Listening https on', this.address()); + } }); }); }