brianc / node-pg-pool

A connection pool for node-postgres
MIT License
180 stars 64 forks source link

Clarification: Default Connections for pg-pool #62

Closed PythonDevOp closed 7 years ago

PythonDevOp commented 7 years ago

I am using pg-pool via the node-postgres driver, and noticed something interesting. On a MAC, I was using the driver in an electron app, and postgres was running locally via PostgresApp. In the electron app, if I didn't pass in any credentials , the connection would still succeed. How odd! When I looked at the pool object, it had my default username (MAC username) running the postgres instance and that was being passed into the connection.

If you need further explanation, please let me know. This is the best way I know how to describe it so far.

My question is this- How does pg-pool know to gather the default user account running the postgres service on my local computer?

brianc commented 7 years ago

https://node-postgres.com/features/connecting#environment-variables https://github.com/brianc/node-postgres/blob/master/lib/defaults.js#L14

Here ya go! Hope this helps. :smile: