Can javascript specify global / default options for setting up HTTPS connections?

If my Node server is making an HTTPS connection to something using self-signed certs, I can make it work by passing a 'ca' option to the https.get function.

var get = https.get({
  path: '/rest',
  host: 'localhost',
  port: 8443,
  ca: [ fs.readFileSync('self-signed-cert.pem') ]
}, function(x) { ... });

But I am using a 3rd party library that makes the HTTPS connection, so I don't have control over the call. Is there a way to specify that all HTTPS connections made should trust this cert? Something like Java's truststore.

You should be able to use https.globalAgent.options.ca = [ fs.readFileSync('self-signed-cert.pem') ]; for requests that use the global/default http agent.