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

Specify CA certificate manually #571

Closed
baoshan opened this issue Mar 16, 2023 · 2 comments
Closed

Specify CA certificate manually #571

baoshan opened this issue Mar 16, 2023 · 2 comments

Comments

@baoshan
Copy link
Contributor

baoshan commented Mar 16, 2023

With deno-postgres, I can specify a .crt file (e.g., supabase.crt), and sslmode=require works (tested just now).

Is this an option for Postgres.js?

@porsager
Copy link
Owner

porsager commented Mar 20, 2023

Yes indeed it is, just use caCerts options as specified in the deno docs in your ssl object like this:

const sql = postgres(url, {
  ssl: {
    caCerts: [await Deno.readTextFile('./cert.pem')]
  }
})

@ralfstx
Copy link

ralfstx commented Aug 2, 2023

BTW, in Node.js you can use { ssl: { ca: [ fs.readFileSync('server-cert.pem') ] }}, see https://nodejs.org/api/tls.html

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

No branches or pull requests

3 participants