Fix wrong elasti client setup when use custom URL

This commit is contained in:
tirongi
2023-12-13 10:47:39 +01:00
parent 6dc7508968
commit 8f4dd8b509
@@ -183,13 +183,26 @@ const prepareConnectionOptions = (
} else if (cloudId) {
let username = getCredentialParam('username', credentialData, nodeData)
let password = getCredentialParam('password', credentialData, nodeData)
elasticSearchClientOptions = {
cloud: {
id: cloudId
},
auth: {
username: username,
password: password
if (cloudId.startsWith('http')) {
elasticSearchClientOptions = {
node: cloudId,
auth: {
username: username,
password: password
},
tls: {
rejectUnauthorized: false
}
}
} else {
elasticSearchClientOptions = {
cloud: {
id: cloudId
},
auth: {
username: username,
password: password
}
}
}
}