Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional poolConfig to Postgres session options #727

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thosakwe
Copy link

@thosakwe thosakwe commented Mar 29, 2024

WHY are these changes introduced?

When using PostgreSQL for sessions, it's not possible to use a host that requires a specific SSL certificate.

For example, DigitalOcean managed databases come with a CA certificate needed for authentication.

The reason you can't use these hosts is because the PostgreSQLSessionStorage constructor has no way to provide SSL options.

WHAT is this pull request doing?

I added an optional pg.PoolConfig option.

Type of change

  • Minor: New feature (non-breaking change which adds functionality)

Checklist

  • I have used yarn changeset to create a draft changelog entry (do NOT update the CHANGELOG.md files manually)
  • I have added/updated tests for this change (no existing tests needed modification)
  • I have documented new APIs/updated the documentation for modified APIs (for public APIs)

@thosakwe
Copy link
Author

I'm actually not sure this is necessary.

It turns out that pg accepts the same environment variables as libpq and psql:

node-postgres uses the same environment variables as libpq and psql to connect to a PostgreSQL server. Both individual clients & pools will use these environment variables.

https://node-postgres.com/features/connecting

So in my case, I could export PGSSLMODE=require and PGSSLROOTCERT=<.ca file path>

If this PR turns out to not be necessary, that's okay, this post will at least be on the Internet to help the next person who has this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant