postgrest
postgrest copied to clipboard
fix: bind admin server to the same host
Reuse main socket address to bind admin socket there too by resolving the address main socket is bound at and binding admin socket to it explicitly.
Introduces extra dependency to iproute for HostAddress -> IP -> String conversions, following the reference in https://www.stackage.org/haddock/lts-22.21/network-3.1.4.0/src/Network.Socket.Info.html#line-415
Fixes #3508
Since this will use the same host, then it would log this when the same port is used, right?
postgrest: Network.Socket.bind: resource busy (Address already in use)
It solves the issue of not allowing the same ports, but I think it's better/simpler to just not execute when server-port and admin-server-port are the same, as it was mentioned in https://github.com/PostgREST/postgrest/issues/3508#issuecomment-2113162578 (perhaps that comment wasn't addressed yet in this PR?)
Closing this in favor of #3559