diff --git a/README.md b/README.md index f40c309b..eee42246 100644 --- a/README.md +++ b/README.md @@ -2591,6 +2591,17 @@ import { parseDsn('postgresql://foo@localhost/bar?application_name=baz'); ``` +Supported parameters: + +|Name|Meaning|Default| +|---|---|---| +|`application_name`|[`application_name`](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-APPLICATION-NAME)|| +|`options`|[`options`](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-OPTIONS)|| +|`sslcert`|The location of the [certificate](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-CLIENTCERT).|-| +|`sslkey`|The location of the [certificate](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-CLIENTCERT).|-| +|`sslmode`|[`sslmode`](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-PROTECTION) (supported values: `disable`, `no-verify`, `require`)|`disable`| +|`sslrootcert`|The location of the [root certificate]((https://www.postgresql.org/docs/current/libpq-ssl.html#LIBQ-SSL-CERTIFICATES)) file.|| + ### stringifyDsn ```ts diff --git a/packages/utilities/src/utilities/parseDsn.ts b/packages/utilities/src/utilities/parseDsn.ts index 0d186049..a446b97a 100644 --- a/packages/utilities/src/utilities/parseDsn.ts +++ b/packages/utilities/src/utilities/parseDsn.ts @@ -56,7 +56,10 @@ export const parseDsn = (dsn: string): ConnectionOptions => { .describe( 'Specifies the location for the secret key used for the client certificate.', ), - sslmode: z.enum(['disable', 'no-verify', 'require']).optional(), + sslmode: z + .enum(['disable', 'no-verify', 'require']) + .optional() + .default('disable'), sslrootcert: z .string() .optional()