Skip to content

Commit

Permalink
feat: allow to listen server on specific host interface (#381)
Browse files Browse the repository at this point in the history
fix #273
  • Loading branch information
mmozeiko committed Dec 18, 2020
1 parent df4ef1f commit 086183b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,20 @@ app
);

const port = Number(process.env.PORT) || 3000;
server.listen(port, () => {
logger.info(`Server ready on port ${port}`, {
label: 'Server',
const host = process.env.HOST;
if (host) {
server.listen(port, host, () => {
logger.info(`Server ready on ${host} port ${port}`, {
label: 'Server',
});
});
});
} else {
server.listen(port, () => {
logger.info(`Server ready on port ${port}`, {
label: 'Server',
});
});
}
})
.catch((err) => {
logger.error(err.stack);
Expand Down

0 comments on commit 086183b

Please sign in to comment.