Sindre
Sindre2y ago

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;
}
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;
}
2 Replies
Sindre
Sindre2y ago
This is now generalized @ravioli You can find a generalized version here: https://hub.windmill.dev/scripts/posgresql/1578/postgres-with-tls-%2F-ssl--posgresql#364 Needs to use the resource that is defined here: https://hub.windmill.dev/resource_types/96/cacertificate
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View