PostgREST / postgrest

REST API for any Postgres database
https://postgrest.org
MIT License
22.65k stars 1k forks source link

fix: bind admin server to the same host #3512

Closed develop7 closed 1 week ago

develop7 commented 1 month ago

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

laurenceisla commented 1 month ago

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?)

develop7 commented 1 week ago

Closing this in favor of #3559