🔀 Merge pull request #785 from flechaig/patch-1

Allow specifying a host on which to listen even with SSL
This commit is contained in:
Alicia Sykes
2022-07-07 18:09:01 +01:00
committed by GitHub

View File

@@ -5,6 +5,8 @@ const https = require('https');
const promise = util.promisify; const promise = util.promisify;
const stat = promise(fs.stat); const stat = promise(fs.stat);
const host = process.env.HOST || '0.0.0.0';
const httpsCerts = { const httpsCerts = {
private: process.env.SSL_PRIV_KEY_PATH || '/etc/ssl/certs/dashy-priv.key', private: process.env.SSL_PRIV_KEY_PATH || '/etc/ssl/certs/dashy-priv.key',
public: process.env.SSL_PUB_KEY_PATH || '/etc/ssl/certs/dashy-pub.pem', public: process.env.SSL_PUB_KEY_PATH || '/etc/ssl/certs/dashy-pub.pem',
@@ -38,7 +40,7 @@ const startSSLServer = (app) => {
key: fs.readFileSync(httpsCerts.private), key: fs.readFileSync(httpsCerts.private),
cert: fs.readFileSync(httpsCerts.public), cert: fs.readFileSync(httpsCerts.public),
}, app); }, app);
httpsServer.listen(SSLPort, () => { printSuccess(); }); httpsServer.listen(SSLPort, host, () => { printSuccess(); });
} }
}); });
}; };