Enable inserting custom URL using basic auth

This commit is contained in:
tirongi
2023-11-21 19:13:19 +01:00
parent e4f2b78e9a
commit 681890a600
2 changed files with 24 additions and 9 deletions
@@ -15,7 +15,7 @@ class ElasticSearchUserPassword implements INodeCredential {
'Refer to <a target="_blank" href="https://www.elastic.co/guide/en/kibana/current/tutorial-secure-access-to-kibana.html">official guide</a> on how to get User Password from ElasticSearch'
this.inputs = [
{
label: 'Cloud ID',
label: 'Cloud ID or custom server URL',
name: 'cloudId',
type: 'string'
},
@@ -144,15 +144,30 @@ export abstract class ElasticSearchBase {
} 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')) {
let username = getCredentialParam('username', credentialData, nodeData)
let password = getCredentialParam('password', credentialData, nodeData)
elasticSearchClientOptions = {
node: cloudId,
auth: {
username: username,
password: password
},
tls: {
rejectUnauthorized: false
}
}
}
} else{
elasticSearchClientOptions = {
cloud: {
id: cloudId
},
auth: {
username: username,
password: password
}
}
}
}
return elasticSearchClientOptions
}