sintaxi/harp

Distinguishing Between Listening on 0.0.0.0 or 127.0.0.1

Opened this issue · 1 comments

Hi,

Not a huge issue, but especially sometimes if something is going haywire in connectivity in a Docker container running Harp, I quickly pop over to the logs and often see the now familiar Your server is listening at http://localhost:9000/. For a moment I think, "oh, yeah, that doesn't work" until I remember that Harp is lying to me, and doesn't distinguish between 0.0.0.0 and 127.0.0.1.

Looking at the code you can see why: https://github.com/sintaxi/harp/blob/master/bin/harp#L89

I was wondering if there was a good reason not to simply get rid of lines 88-93, and changing 94 to be like so:

var hostUrl = "http://" + ip + ":" + port + "/"

?

Or, if the localhost text is really preferred, limiting it to only 127.0.0.1? I'd be happy to throw together a pull request for this if there's interest.

Would be nice.