agenda/agendash

MongoDB connection with SSL

Opened this issue · 1 comments

D-32 commented

For anybody that's looking to connect to a database with SSL, I got it to work by modifying agendash-standalone.js.
Replace line 21 with:

const certFileBuf = fs.readFileSync(
  "mycert.pem"
);
const agenda = new Agenda({
  db: {
    address: program.db,
    collection: program.collection,
    options: {
      sslCA: certFileBuf,
    },
  },
});

Does setting the env variable NODE_EXTRA_CA_CERTS work for you? It solved the same problem for a case for us, not needing to modify the code and get SSL with a MongoDB.

See https://nodejs.org/api/cli.html#node_extra_ca_certsfile