Browse Source

added HOSTNAME env variable

master
mortie 6 years ago
parent
commit
1e381ee2e7
2 changed files with 5 additions and 4 deletions
  1. 3
    2
      README.md
  2. 2
    2
      index.js

+ 3
- 2
README.md View File

* `server`: Your own HTTP (like the one created by http.createHttpServer). * `server`: Your own HTTP (like the one created by http.createHttpServer).
* `port`: The port to listen on. Defaults to the PORT environment variable, or * `port`: The port to listen on. Defaults to the PORT environment variable, or
8080. 8080.
* `host`: The host to listen on. Defaults to "127.0.0.1". For the server to be
accessible to the outside world, listen on "0.0.0.0".
* `host`: The host to listen on. Defaults to the HOSTNAME environment variable,
or "127.0.0.1". For the server to be accessible to the outside world, listen
on "0.0.0.0".
* `client_utils`: Whether to add some utility functions to /webframe.js. * `client_utils`: Whether to add some utility functions to /webframe.js.
Defaults to false. Defaults to false.
* `res404`: The string to return for a 404 error. "{{pathname}}" will be * `res404`: The string to return for a 404 error. "{{pathname}}" will be

+ 2
- 2
index.js View File

} else { } else {
this.server = http.createServer(); this.server = http.createServer();


var port = options.port || process.env.PORT | 8080;
var host = options.host || "127.0.0.1";
var port = options.port || process.env.PORT || 8080;
var host = options.host || process.env.HOSTNAME || "127.0.0.1";


this.server.listen(port, host); this.server.listen(port, host);
this.info("Listening on "+host+":"+port); this.info("Listening on "+host+":"+port);

Loading…
Cancel
Save