|
@@ -1,6 +1,7 @@
|
|
const _ = require('lodash')
|
|
const _ = require('lodash')
|
|
const stream = require('stream')
|
|
const stream = require('stream')
|
|
const Promise = require('bluebird')
|
|
const Promise = require('bluebird')
|
|
|
|
+const fs = require('fs')
|
|
const pipeline = Promise.promisify(stream.pipeline)
|
|
const pipeline = Promise.promisify(stream.pipeline)
|
|
|
|
|
|
/* global WIKI */
|
|
/* global WIKI */
|
|
@@ -24,6 +25,7 @@ module.exports = {
|
|
nodes: this.config.hosts.split(',').map(_.trim),
|
|
nodes: this.config.hosts.split(',').map(_.trim),
|
|
sniffOnStart: this.config.sniffOnStart,
|
|
sniffOnStart: this.config.sniffOnStart,
|
|
sniffInterval: (this.config.sniffInterval > 0) ? this.config.sniffInterval : false,
|
|
sniffInterval: (this.config.sniffInterval > 0) ? this.config.sniffInterval : false,
|
|
|
|
+ ssl: getTlsOptions(this.config),
|
|
name: 'wiki-js'
|
|
name: 'wiki-js'
|
|
})
|
|
})
|
|
break
|
|
break
|
|
@@ -33,6 +35,7 @@ module.exports = {
|
|
nodes: this.config.hosts.split(',').map(_.trim),
|
|
nodes: this.config.hosts.split(',').map(_.trim),
|
|
sniffOnStart: this.config.sniffOnStart,
|
|
sniffOnStart: this.config.sniffOnStart,
|
|
sniffInterval: (this.config.sniffInterval > 0) ? this.config.sniffInterval : false,
|
|
sniffInterval: (this.config.sniffInterval > 0) ? this.config.sniffInterval : false,
|
|
|
|
+ ssl: getTlsOptions(this.config),
|
|
name: 'wiki-js'
|
|
name: 'wiki-js'
|
|
})
|
|
})
|
|
break
|
|
break
|
|
@@ -351,3 +354,21 @@ module.exports = {
|
|
WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Index rebuilt successfully.`)
|
|
WIKI.logger.info(`(SEARCH/ELASTICSEARCH) Index rebuilt successfully.`)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+function getTlsOptions(conf) {
|
|
|
|
+ if (!conf.tlsCertPath) {
|
|
|
|
+ return {
|
|
|
|
+ rejectUnauthorized: conf.verifyTLSCertificate
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const caList = []
|
|
|
|
+ if (conf.verifyTLSCertificate) {
|
|
|
|
+ caList.push(fs.readFileSync(conf.tlsCertPath))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ rejectUnauthorized: conf.verifyTLSCertificate,
|
|
|
|
+ ca: caList
|
|
|
|
+ }
|
|
|
|
+}
|