SindreS
Windmill3y ago
1 reply
Sindre

postgres with tls

I do this @ravioli
import * as wmill from "https://deno.land/x/windmill@v1.100.2/mod.ts";

export async function main(
  dbConfig: wmill.Resource<"postgresql">,
) {
  const caCert = await wmill.getVariable("f/invoicing/CA_CERT");
  dbConfig.tls.caCertificates = [caCert];

  const client = new Client(dbConfig);
  await client.connect();

  const res = await client.queryObject(
    `select * from youcandothis`,
  );

  await client.end();

  return res.rows;
}
Was this page helpful?