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.
This commit is contained in:
flechaig 2022-07-07 17:05:47 +02:00 committed by GitHub
parent 6f7c89deeb
commit b4db66f339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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(); });
}
});
};