Skip to content

Commit

Permalink
feat(server): add HOST environment variable support to bind to a spe…
Browse files Browse the repository at this point in the history
…cific network address
  • Loading branch information
vicchi committed Jul 16, 2020
1 parent cdb7c27 commit d42f9e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const util = require('util');
const app = require('./app')();

try {
const port = ( parseInt(process.env.PORT) || 3102 );
const host = process.env.HOST || undefined;

app.listen(port, () => {
console.log(`pip-service is now running on port ${port}`);
app.listen(port, host, () => {
console.log(util.format( 'pip-service is now running on %s:%s', host || '0.0.0.0', port ));
});

} catch (err) {
Expand Down

0 comments on commit d42f9e1

Please sign in to comment.