postgrest icon indicating copy to clipboard operation
postgrest copied to clipboard

Bogus `Listening on port 0` message, provide useful info

Open strk opened this issue 2 years ago • 1 comments

I'm willing to find a random available port for my postgrest service, so I run:

PGRST_SERVER_PORT=0 postgrest postgrest.conf

It works fine, except then I'm left alone in figuring out which port the kernel assigned to the socket, becuase postgrest just reports:

10/Aug/2022:17:31:57 +0200: Listening on port 0

Maybe the message should advertise the actual port being used ?

strk avatar Aug 10 '22 15:08 strk

This is very similar to #2174. This was fixed in #2182. That same approach won't work here, I think.

If we had fixed that according to https://github.com/PostgREST/postgrest/issues/2174#issuecomment-1045978929, we'd have the code in place to extract the actually used port, too.

I think we should fix both together: I.e. always extract the actual host and port used and not guess anything.

wolfgangwalther avatar Aug 11 '22 16:08 wolfgangwalther

Going a little further, can the server-port setting be optional at all then?

develop7 avatar Nov 17 '23 14:11 develop7

Right now server-port is optional because we default it to 3000. Hm, not sure if we should change the default to 0 because that would also imply changing the docs in several places.

steve-chavez avatar Nov 17 '23 18:11 steve-chavez

Hm, not sure if we should change the default to 0 because that would also imply changing the docs in several places.

Uh, why? That would be quite a breaking change, no?

wolfgangwalther avatar Nov 17 '23 18:11 wolfgangwalther

Oh, I forgot that. That'd be a breaking change indeed.

On Fri, Nov 17, 2023, 19:30 Steve Chavez @.***> wrote:

Right now server-port is optional because we default it to 3000. Hm, not sure if we should change the default to 0 because that would also imply changing the docs in several places.

— Reply to this email directly, view it on GitHub https://github.com/PostgREST/postgrest/issues/2420#issuecomment-1816899846, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAV6IPYQJHDYOCRLLQFSRTYE6UKVAVCNFSM56E7VOE2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBRGY4DSOJYGQ3A . You are receiving this because you commented.Message ID: @.***>

develop7 avatar Nov 17 '23 18:11 develop7