atproto icon indicating copy to clipboard operation
atproto copied to clipboard

Increase flexibility of paramaters accepted by DB_CREDS_JSON env var

Open mileszim opened this issue 1 year ago • 1 comments

Summary

  • Added default values for the username, password, host, port, and database parameters of the pgUrl function.
  • Added an optional sslmode parameter to the pgUrl 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

mileszim avatar May 04 '23 08:05 mileszim

I am down to land this! Just a headsup that we'll probably also be tidying-up the PDS config in the coming weeks.

devinivy avatar May 15 '23 15:05 devinivy