diff --git a/bin/letsencrypt.js b/bin/letsencrypt.js index 13eb9c4..356b21a 100755 --- a/bin/letsencrypt.js +++ b/bin/letsencrypt.js @@ -19,7 +19,7 @@ cli.parse({ , 'domain-key-path': [ false, " Path to privkey.pem to use for domain (default: generate new)", 'string' ] , 'config-dir': [ false, " Configuration directory.", 'string', '~/letsencrypt/etc/' ] , server: [ false, " ACME Directory Resource URI.", 'string', 'https://acme-v01.api.letsencrypt.org/directory)' ] -, standalone: [ false, " Obtain certs using a \"standalone\" webserver.", 'boolean', true ] +, standalone: [ false, " Obtain certs using a \"standalone\" webserver.", 'boolean', false ] //, manual: [ false, " Provide laborious manual instructions for obtaining a cert (default: false)", 'boolean', false ] , webroot: [ false, " Obtain certs by placing files in a webroot directory.", 'boolean', false ] , 'webroot-path': [ false, " public_html / webroot path.", 'string' ] @@ -79,18 +79,20 @@ cli.main(function(_, options) { var LE = require('letsencrypt'); var handlers; - - if (args.standalone) { + + if (args.webrootPath) { + handlers = require('../lib/webroot').create(args); + } + else /*if (args.standalone)*/ { handlers = require('../lib/standalone').create(); handlers.startServers(args.http01Ports || [80], args.tlsSni01Port || [443, 5001]); } - else if (args.webrootPath) { - handlers = require('../lib/webroot').create(args); - } - LE.create({}, handlers).register(args, function (err, results) { + // let LE know that we're handling standalone / webroot here + LE.create({ manual: true }, handlers).register(args, function (err, results) { if (err) { - console.error(err.stack); + console.error('[Error]: letsencrypt'); + console.error(err); return; } diff --git a/lib/standalone.js b/lib/standalone.js index 5191ce4..5982c38 100644 --- a/lib/standalone.js +++ b/lib/standalone.js @@ -1,7 +1,7 @@ 'use strict'; -var handlers = module.exports.create = function () { - return { +module.exports.create = function () { + var handlers = { // // set,get,remove challenges // @@ -66,4 +66,6 @@ var handlers = module.exports.create = function () { handlers._servers = []; } }; + + return handlers; }; diff --git a/lib/webroot.js b/lib/webroot.js index 8f37ae6..81b4eb6 100644 --- a/lib/webroot.js +++ b/lib/webroot.js @@ -1,11 +1,11 @@ 'use strict'; -var handlers = module.exports.create = function (defaults) { +module.exports.create = function (defaults) { var fs = require('fs'); var path = require('path'); var mkdirp = require('mkdirp'); - return { + var handlers = { // // set,get,remove challenges // @@ -48,4 +48,6 @@ var handlers = module.exports.create = function (defaults) { }); } }; + + return handlers; };