From f25ffa968a04d57aae83e7d6bfac9962bde02934 Mon Sep 17 00:00:00 2001 From: Harald Schilly Date: Wed, 10 Nov 2021 19:47:01 +0100 Subject: [PATCH 1/2] default database name depends on $PGUSER first, then $USER If I get this right, the spot in the code to know for that is https://github.com/brianc/node-postgres/blob/947ccee346f0d598e135548e1e4936a9a008fc6f/packages/pg/lib/connection-parameters.js#L9 --- content/api/2-client.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/api/2-client.mdx b/content/api/2-client.mdx index f87bc68..93a4f5d 100644 --- a/content/api/2-client.mdx +++ b/content/api/2-client.mdx @@ -14,7 +14,7 @@ config = { user?: string, // default process.env.PGUSER || process.env.USER password?: string or function, //default process.env.PGPASSWORD host?: string, // default process.env.PGHOST - database?: string, // default process.env.PGDATABASE || process.env.USER + database?: string, // default process.env.PGDATABASE || process.env.PGUSER || process.env.USER port?: number, // default process.env.PGPORT connectionString?: string, // e.g. postgres://user:password@host:5432/database ssl?: any, // passed directly to node.TLSSocket, supports all tls.connect options From 36e5832953488486c3f00ea57f5b55131ff06bed Mon Sep 17 00:00:00 2001 From: Harald Schilly Date: Thu, 16 Dec 2021 12:25:18 +0100 Subject: [PATCH 2/2] database name fallback is its respective env variable or the user name Co-authored-by: Charmander <~@charmander.me> --- content/api/2-client.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/api/2-client.mdx b/content/api/2-client.mdx index 93a4f5d..e54241f 100644 --- a/content/api/2-client.mdx +++ b/content/api/2-client.mdx @@ -14,7 +14,7 @@ config = { user?: string, // default process.env.PGUSER || process.env.USER password?: string or function, //default process.env.PGPASSWORD host?: string, // default process.env.PGHOST - database?: string, // default process.env.PGDATABASE || process.env.PGUSER || process.env.USER + database?: string, // default process.env.PGDATABASE || user port?: number, // default process.env.PGPORT connectionString?: string, // e.g. postgres://user:password@host:5432/database ssl?: any, // passed directly to node.TLSSocket, supports all tls.connect options