await icon indicating copy to clipboard operation
await copied to clipboard

Check if postgres has started without a user/pass

Open lox opened this issue 7 years ago • 3 comments

Would it be possible to do a check for postgres without a user/pass? There is a window of time between when it accepts tcp sockets and when it accepts logins. I'd like to not have to have user/password passed to await for this check.

lox avatar Mar 02 '17 06:03 lox

Should be doable, testing might be trickier.

I guess there are more testable and tolerable states: port bound > server up and accept > server up and accept only pass > tables are available > tables have data.

Are you using the pq compatible connection parameters user & pass, or just url user:pass? For completeness I might take care of both.

djui avatar Mar 02 '17 07:03 djui

Yup, that hierarchy of states seems reasonable and unsurprising. I tried without a user / pass and got the following (only when using -vv):

api_1       | 2017/03/02 10:27:59 Awaiting resource: postgres://postgres:5432
api_1       | 2017/03/02 10:27:59 Resource unavailable: pq: Could not detect default username. Please provide one explicitly.

I'd expect that without a user / pass it would check port bound and server started.

I suspect it's a bug that Could not detect default username. Please provide one explicitly is not a fatal error.

lox avatar Mar 02 '17 10:03 lox

Btw, I'd also suggest that passwords be masked in the output. Currently even with -v the password in the connection string is shown.

lox avatar Mar 02 '17 10:03 lox