diff --git a/example/letsencrypt.js b/example/letsencrypt.js index 532f53f..5bb2255 100644 --- a/example/letsencrypt.js +++ b/example/letsencrypt.js @@ -15,6 +15,7 @@ var acmeDiscoveryUrl = LeCore.stagingServerUrl; var challengeStore = require('./challenge-store'); var certStore = require('./cert-store'); var serve = require('./serve'); +var closer; var accountPrivateKeyPem = null; var domainPrivateKeyPem = null; @@ -94,6 +95,7 @@ function runDemo() { console.log('[certs]'); console.log(err || certs); + closer(); }); @@ -106,7 +108,7 @@ function runDemo() { // // Setup the Server // -serve.init({ +closer = serve.init({ LeCore: LeCore // needs a default key and cert chain, anything will do , httpsOptions: require('localhost.daplie.com-certificates') diff --git a/example/serve.js b/example/serve.js index 1f7f322..53faec4 100644 --- a/example/serve.js +++ b/example/serve.js @@ -73,4 +73,10 @@ module.exports.init = function (deps) { http.createServer(acmeResponder).listen(80, function () { console.log('Listening http on', this.address()); }); + + return function () { + // Note: we should just keep a handle on + // the servers and close them each with server.close() + process.exit(1); + }; };