D
Deno

help

Is there an easy way to read tls certificate and key from a filesystem?

GBQ1girl, best quality3/11/2024
I do the following:
if (Deno.env.has("TLS_CERT_PATH") && Deno.env.has("TLS_PKEY_PATH")) {
const tlsCert = Deno.readFileSync(Deno.env.get("TLS_CERT_PATH"));
const tlsPkey = Deno.readFileSync(Deno.env.get("TLS_PKEY_PATH"));
serverOptions = { cert: tlsCert, key: tlsPkey };
}
if (Deno.env.has("TLS_CERT_PATH") && Deno.env.has("TLS_PKEY_PATH")) {
const tlsCert = Deno.readFileSync(Deno.env.get("TLS_CERT_PATH"));
const tlsPkey = Deno.readFileSync(Deno.env.get("TLS_PKEY_PATH"));
serverOptions = { cert: tlsCert, key: tlsPkey };
}
and it doesn't work because apparently it wants a string, not a uint8array. I don't know what's a good way to get a string from a uint8array or to read a string from fs.
IioB3/11/2024
Deno.readTextFileSync

Looking for more? Join the community!