add ability to listen on unix domain socket - #1123
Conversation
|
I don't like adding a new config value for this. I think we can use the |
|
That sounds like a good idea, I hadn't thought of that. It makes sense to do that since the two are both strings and only one form can be used at a time. I can rework the change to repurpose hostname when wanting to use a unix domain socket. I will try to get that updated tomorrow morning and resubmitted. Thanks! |
If host contains a `/` then it is assumed to be a path to a unix domain socket and the server will bind to that instead of using TCP It will also set `server.info.unixDomainSocket` to the absolute path to the socket.
If server option `host` contains a `/` then it is assumed to be a unix domain socket and the server will listen on it rather than TCP. `server.info.unixDomainSocket` will contain the absolute path to the socket it is listening on.
|
@hueniverse I have reimplemented this using the premise that if host contains a '/' it implies a unix domain socket. See if this is acceptable or whether it needs additional work. Thanks! |
add ability to listen on unix domain socket
|
Thanks for merging this in Eran! |
|
Awesome work @jeffbski this is awesome. One situation we're running into is in dev, we supply a host of '127.0.0.1' and port of 8000 and on production we'd like to be able to supply a host of '/var/www/app/shared/app.sock'. Everything is fine up to this point :) BUT we use the hapi cli and our manifest servers attr looks like This will not work in prod when HOST is a socket as we can't supply a port due to https://github.com/spumko/hapi/blob/master/lib/server.js#L71 Feels like instead of erroring we should be just dropping the port. Thoughts @jeffbski @hueniverse ? |
|
Open an issue and I'll think about it. |
add ability to listen on unix domain socket
Provide ability to listen on a unix domain socket rather than TCP if the server option
unixDomainSocketis passed with a path.If a unix domain socket is used,
server.info.unixDomainSocketwill contain the absolute path to the socket the server is listening to.Example:
I have updated the docs, provided failing tests, and an implementation.