This repository was archived by the owner on May 28, 2023. It is now read-only.

Description
Currently, we have have a code duplication with Elastic:
- migrations/.common.js
- platform/magento1/tax.js
- platform/magento2/tax.js
we should extract the Elastic client setup code to ../../helpers/elastic.js
kind of:
const getElasticClient = (config) => {
const esConfig = { // as we're runing tax calculation and other data, we need a ES indexer
host: {
host: config.elasticsearch.host,
port: config.elasticsearch.port,
protocol: config.elasticsearch.protocol
},
apiVersion: config.elasticsearch.apiVersion,
requestTimeout: 5000
}
if (config.elasticsearch.user) {
esConfig.httpAuth = config.elasticsearch.user + ':' + config.elasticsearch.password
}
return new es.Client(esConfig)
}