mirror of
https://github.com/key-networks/ztncui.git
synced 2024-08-31 04:28:00 +00:00
Document the HTTP_ALL_INTERFACES feature
This commit is contained in:
20
src/bin/www
20
src/bin/www
@@ -30,17 +30,23 @@ app.set('https_port', https_port);
|
||||
const https_host = process.env.HTTPS_HOST || null;
|
||||
app.set('https_host', https_host);
|
||||
|
||||
/**
|
||||
* Create HTTPS server and listen on localhost only for HTTP, unless the
|
||||
* environment variable HTTP_ALL_INTERFACES is set, and
|
||||
* on all network interfaces for HTTPS if HTTPS_PORT is set in env,
|
||||
* or on specific interface if HTTPS_HOST is set in env.
|
||||
/** Create HTTPS server and listen for protocols on interfaces and ports
|
||||
* according to environment variables as follows:
|
||||
* Environment variable Protocol Listen On Port
|
||||
* -------------------- -------- --------- ----
|
||||
* <none> HTTP localhost 3000
|
||||
* HTTP_PORT HTTP localhost HTTP_PORT
|
||||
* HTTP_ALL_INTERFACES HTTP all interfaces HTTP_PORT || 3000
|
||||
* HTTPS_PORT HTTPS all interfaces HTTPS_PORT
|
||||
* HTTPS_HOST HTTPS HTTPS_HOST HTTPS_PORT
|
||||
*/
|
||||
|
||||
const http_all_int = process.env.HTTP_ALL_INTERFACES || null;
|
||||
if (http_all_int) {
|
||||
const http_all_interfaces = process.env.HTTP_ALL_INTERFACES || null;
|
||||
if (http_all_interfaces) {
|
||||
console.log('Listening for HTTP requests on port ' + http_port + ' on all interfaces');
|
||||
app.listen(http_port);
|
||||
} else {
|
||||
console.log('Listening for HTTP requests on port ' + http_port + ' on localhost');
|
||||
app.listen(http_port, 'localhost');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ztncui",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www",
|
||||
|
||||
Reference in New Issue
Block a user