atproto
atproto copied to clipboard
Increase flexibility of paramaters accepted by DB_CREDS_JSON env var
Summary
- Added default values for the
username
,password
,host
,port
, anddatabase
parameters of thepgUrl
function. - Added an optional
sslmode
parameter to thepgUrl
function. - These default values are intended to ensure that the
pgUrl
function can still connect to the PostgreSQL database even if not all the parameters are provided.
Examples
1. With original options:
{
"username": "myuser",
"password": "mypassword",
"host": "localhost",
"port": "5432"
}
Output:
postgresql://myuser:mypassword@localhost:5432/postgres
2. With new options including sslmode
:
{
"username": "myuser",
"password": "mypassword",
"host": "localhost",
"port": "5432",
"database": "mydb",
"sslmode": "require"
}
Output:
postgresql://myuser:mypassword@localhost:5432/mydb?sslmode=require
I am down to land this! Just a headsup that we'll probably also be tidying-up the PDS config in the coming weeks.