Read the cert
This commit is contained in:
parent
97fa5caed9
commit
9d977fd31c
|
@ -1,15 +1,20 @@
|
|||
import { readFileSync } from 'fs-extra'
|
||||
import { flatMap } from 'lodash'
|
||||
import { ApiResponse, Client } from '@elastic/elasticsearch'
|
||||
import { CONFIG } from '../initializers/constants'
|
||||
import { logger } from './logger'
|
||||
import { flatMap } from 'lodash'
|
||||
import { IndexableDoc } from '../types/elastic-search.model'
|
||||
import { logger } from './logger'
|
||||
|
||||
const elasticOptions = {
|
||||
node: CONFIG.ELASTIC_SEARCH.HTTP + '://' + CONFIG.ELASTIC_SEARCH.HOSTNAME + ':' + CONFIG.ELASTIC_SEARCH.PORT
|
||||
}
|
||||
|
||||
if (CONFIG.ELASTIC_SEARCH.SSL.CA) {
|
||||
Object.assign(elasticOptions, { ssl: { ca: CONFIG.ELASTIC_SEARCH.SSL.CA } })
|
||||
Object.assign(elasticOptions, {
|
||||
ssl: {
|
||||
ca: readFileSync(CONFIG.ELASTIC_SEARCH.SSL.CA)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const elasticSearch = new Client(elasticOptions)
|
||||
|
|
Loading…
Reference in New Issue