Browse Source

Ask Node's `net.server` for the actual address its listening on

This allows us to emit a helpful and correct message when Pelias starts.
pull/1043/head
Julian Simioni 7 years ago
parent
commit
65507807ac
No known key found for this signature in database
GPG Key ID: 6DAD08919FDBF563
  1. 8
      index.js

8
index.js

@ -3,6 +3,8 @@ const app = require('./app'),
port = ( process.env.PORT || 3100 ), port = ( process.env.PORT || 3100 ),
host = ( process.env.HOST || undefined ); host = ( process.env.HOST || undefined );
/** run server on the default setup (single core) **/ const server = app.listen( port, host, () => {
console.log( `pelias is now running on ${host}:${port}` ); // ask server for the actual address and port its listening on
app.listen( port, host ); const listenAddress = server.address();
console.log( `pelias is now running on ${listenAddress.address}:${listenAddress.port}` );
});

Loading…
Cancel
Save