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

Commit 2dc690f

Browse files
authored
Merge pull request #304 from icmaa/bugfix/303-use-https-protocol-for-connections
Force ES connections to use protocol config option
2 parents 9b33d71 + 6aa8ae6 commit 2dc690f

File tree

8 files changed

+22
-7
lines changed

8 files changed

+22
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Fixed
1414
- The `product.price_*` fields have been normalized with the backward compatibility support (see `config.tax.deprecatedPriceFieldsSupport` which is by default true) - @pkarw (#289)
1515
- The `product.final_price` field is now being taken into product price calcualtion. Moreover, we've added the `config.tax.finalPriceIncludesTax` - which is set to `true` by default. All the `price`, `original_price` and `special_price` fields are calculated accordingly. It was required as Magento2 uses `final_price` to set the catalog pricing rules after-prices - @pkarw (#289)
16+
- Force ES connections to use protocol config option - @cewald (#303, #304)
1617
- Better handling of HTTP error codes provided by API client - #3151
1718

1819
## [1.10.0-rc.1] - UNRELEASED

migrations/.common.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ let queue = kue.createQueue(Object.assign(config.kue, { redis: config.redis }))
55

66
let es = require('elasticsearch')
77
const esConfig = {
8-
host: config.elasticsearch.host + ':' + config.elasticsearch.port,
8+
host: {
9+
host: config.elasticsearch.host,
10+
port: config.elasticsearch.port,
11+
protocol: config.elasticsearch.protocol
12+
},
913
log: 'debug',
1014
apiVersion: config.elasticsearch.apiVersion,
1115
requestTimeout: 1000 * 60 * 60,

src/api/catalog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default ({config, db}) => function (req, res, body) {
6565
let url = config.elasticsearch.host + ':' + config.elasticsearch.port + (req.query.request ? _updateQueryStringParameter(req.url, 'request', null) : req.url)
6666

6767
if (!url.startsWith('http')) {
68-
url = 'http://' + url
68+
url = config.elasticsearch.protocol + '://' + url
6969
}
7070

7171
// Check price tiers

src/api/extensions/gls-parcelshop-dk/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ cli.command('buildcache', () => {
1818
const esConfig = {
1919
host: {
2020
host: config.elasticsearch.host,
21-
port: config.elasticsearch.port
21+
port: config.elasticsearch.port,
22+
protocol: config.elasticsearch.protocol
2223
},
2324
log: 'debug',
2425
apiVersion: config.elasticsearch.apiVersion,

src/api/extensions/gls-parcelshop-dk/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = ({config, db}) => {
2222
returnData.droppoints = []
2323

2424
// pass the request to elasticsearch
25-
const url = 'http://' + config.elasticsearch.host + ':' + config.elasticsearch.port + '/gls_parcelshop_dk/droppoint/_search';
25+
const url = config.elasticsearch.protocol + '://' + config.elasticsearch.host + ':' + config.elasticsearch.port + '/gls_parcelshop_dk/droppoint/_search';
2626

2727
request({ // do the elasticsearch request
2828
uri: url,

src/graphql/elasticsearch/client.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import config from 'config';
22
import elasticsearch from 'elasticsearch';
33

44
const client = new elasticsearch.Client({
5-
host: config.elasticsearch.host + ':' + config.elasticsearch.port
5+
host: {
6+
host: config.elasticsearch.host,
7+
port: config.elasticsearch.port,
8+
protocol: config.elasticsearch.protocol
9+
},
610
});
711

812
export default client;

src/platform/magento1/tax.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class TaxProxy extends AbstractTaxProxy {
7272
const esConfig = { // as we're runing tax calculation and other data, we need a ES indexer
7373
host: {
7474
host: this._config.elasticsearch.host,
75-
port: this._config.elasticsearch.port
75+
port: this._config.elasticsearch.port,
76+
protocol: this._config.elasticsearch.protocol
7677
},
7778
log: 'debug',
7879
apiVersion: this._config.elasticsearch.apiVersion,

src/platform/magento2/tax.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ class TaxProxy extends AbstractTaxProxy {
6969

7070
if (this._config.tax.calculateServerSide) {
7171
const esConfig = { // as we're runing tax calculation and other data, we need a ES indexer
72-
host: this._config.elasticsearch.host + ':' + this._config.elasticsearch.port,
72+
host: {
73+
host: this._config.elasticsearch.host,
74+
port: this._config.elasticsearch.port,
75+
protocol: this._config.elasticsearch.protocol
76+
},
7377
log: 'debug',
7478
apiVersion: this._config.elasticsearch.apiVersion,
7579
requestTimeout: 5000

0 commit comments

Comments
 (0)