Is there an equivalent to `c, err := client.New(*c...
# help
d
Is there an equivalent to
c, err := client.New(*cerbosAddr, client.WithTLSInsecure())
for the Javascript GRPC client? i.e. use TLS, but allow insecure.
a
d
Hi! Yes I was reading that but (if I understand correctly) its either false = no TLS, or true = TLS with valid/well-known cert. Im looking for the awkward middle ground šŸ™‚ - TLS with self-signed cert
a
Ah I see - not sure of the top of my head, but you can pass in a
SecureContext
created via https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions What that needs to look like for a self-signed cert I’m not 100% sure
I suspect you may need to tell node to ignore them https://nodejs.org/api/cli.html#node_tls_reject_unauthorizedvalue
so maybe set the tls option to
true
then run your app with an env var of `*`NODE_TLS_REJECT_UNAUTHORIZED=0``*
šŸ‘ 1
o
I think something like this could work too;
Copy code
const secureContext = tls.createSecureContext();
secureContext.context.addCACert("-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----");
šŸ‘ 2
d
Many thanks, both solutions will work I think. But NODE_TLS_REJECT_UNAUTHORIZED is fine for testing. šŸ‘