carbon-io / carbond

MIT License
2 stars 5 forks source link

Listen on random port #150

Closed BenElgar closed 6 years ago

BenElgar commented 7 years ago

With a standard node server you can omit the port argument or set it equal to 0 to listen on a random port (https://nodejs.org/docs/latest/api/net.html#net_server_listen_port_hostname_backlog_callback). It would be nice if that was also available in carbon. At the moment there is a falsey check that precludes this: https://github.com/carbon-io/carbond/blob/4e756902217bb6c636a4958d4fc0d28c5de75a5d/lib/Service.js#L588-L590

BenElgar commented 7 years ago

In any case, a more rigorous check ensuring that the port is between 0 and 65535—the maximum allowable port number—might be advisable.