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

Refactor the way Elastic client is being setup #327

@pkarw

Description

@pkarw

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)	
	}

Metadata

Metadata

Labels

feature requestRequests for new features. Please be as specific as possible

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions