From b4db66f339a2069d9685bb172c1ec3fb0f4c916a Mon Sep 17 00:00:00 2001 From: flechaig Date: Thu, 7 Jul 2022 17:05:47 +0200 Subject: [PATCH] Allow specifying a host on which to listen even with SSL Allow specifying a host on which to listen even with SSL Grab the IP address from the HOST environment variable and use it to bind the SSL server. Default to 0.0.0.0 IPv6 compliant. --- services/ssl-server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/ssl-server.js b/services/ssl-server.js index c63b7db3..805434ef 100644 --- a/services/ssl-server.js +++ b/services/ssl-server.js @@ -1,3 +1,5 @@ +const host = process.env.HOST || '0.0.0.0'; + const fs = require('fs'); const util = require('util'); const https = require('https'); @@ -38,7 +40,7 @@ const startSSLServer = (app) => { key: fs.readFileSync(httpsCerts.private), cert: fs.readFileSync(httpsCerts.public), }, app); - httpsServer.listen(SSLPort, () => { printSuccess(); }); + httpsServer.listen(SSLPort, host, () => { printSuccess(); }); } }); };