feat: allow to listen server on specific host interface (#381)

fix #273
pull/382/head
Mārtiņš Možeiko 4 years ago committed by GitHub
parent df4ef1fbe5
commit 086183b563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);

Loading…
Cancel
Save