Javascript 使用thinky.io连接到compose.io.db服务器

Javascript 使用thinky.io连接到compose.io.db服务器,javascript,node.js,rethinkdb,compose,thinky,Javascript,Node.js,Rethinkdb,Compose,Thinky,我正在尝试使用thinky.io连接到compose.io上托管的referencedb服务器 根据文档,我可以使用r.connect连接以下内容: const r = require('rethinkdb'); const fs = require('fs'); fs.readFile('../cacert', function(err, caCert) { r.connect({ authKey: 'MY_KEY', host: 'aws-us-east-1-portal

我正在尝试使用thinky.io连接到compose.io上托管的referencedb服务器

根据文档,我可以使用r.connect连接以下内容:

const r = require('rethinkdb');
const fs = require('fs');
fs.readFile('../cacert', function(err, caCert) {
  r.connect({
    authKey: 'MY_KEY',
    host: 'aws-us-east-1-portal.5.dblayer.com',
    port: 11190,
    ssl: {
      ca: caCert
    }
  }, function(error, conn) {
    r.dbList().run(conn, function(err, results) {
      console.log(results);
    })
  })
});
但是,当使用thinky.io时,它将不接受SSL证书,我将使用以下不起作用的连接:

const thinky = require('thinky')({
  authKey: 'MY_KEY',
  host: 'aws-us-east-1-portal.5.dblayer.com',
  port: 11190,
});
是否有任何方法可以使用thinky.io连接到compose,或者使用
r.connect()
连接到compose,然后使用thinky.io的现有连接

My node.js服务器托管在heroku上

感谢使用同步读取文件 使用同步读取文件的解决方案:

在设置RejectDB数据库时,将thinky.iocompose.io一起使用的一种方法是在设置thinky.io连接之前读取ca证书时使用同步读取文件方法

const fs = require('fs');
const config = require('../config')

const caCert = fs.readFileSync('cacert')

const thinky = require('thinky')({
  authKey: config.authKey,
  host: 'aws-us-east-1-portal.5.dblayer.com',
  port: 11190,
  ssl: {
    ca: caCert
  }
});

module.exports = thinky;