Skip to content

Commit

Permalink
fix(sirv-cli): add missing HOST and PORT support
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Jun 1, 2019
1 parent 210302e commit 04ea942
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/sirv-cli/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const tinydate = require('tinydate');
const toPort = require('get-port');

const PAD = ' ';
const { HOST, PORT } = process.env;
const stamp = tinydate('{HH}:{mm}:{ss}');

function toTime() {
Expand Down Expand Up @@ -55,10 +56,11 @@ module.exports = function (dir, opts) {
});
}

opts.port = PORT || opts.port;
toPort(opts.port).then(port => {
let https = !!opts.ssl; // TODO
let hostname = opts.host;
let isOther = port !== opts.port;
let isOther = port != opts.port;
let hostname = HOST || opts.host;
server.listen(port, hostname, err => {
if (err) throw err;
if (opts.quiet) return;
Expand Down
2 changes: 2 additions & 0 deletions packages/sirv-cli/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ $ sirv start --help
-h, --help Displays this message
```

> **Note:** The `HOST` and `PORT` environment variables will override flag values.

## License

Expand Down

0 comments on commit 04ea942

Please sign in to comment.