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' '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 = [ this.inputs = [
{ {
label: 'Cloud ID', label: 'Cloud ID or custom server URL',
name: 'cloudId', name: 'cloudId',
type: 'string' type: 'string'
}, },
@@ -144,6 +144,20 @@ export abstract class ElasticSearchBase {
} else if (cloudId) { } else if (cloudId) {
let username = getCredentialParam('username', credentialData, nodeData) let username = getCredentialParam('username', credentialData, nodeData)
let password = getCredentialParam('password', credentialData, nodeData) let password = getCredentialParam('password', credentialData, nodeData)
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 = { elasticSearchClientOptions = {
cloud: { cloud: {
id: cloudId id: cloudId
@@ -154,6 +168,7 @@ export abstract class ElasticSearchBase {
} }
} }
} }
}
return elasticSearchClientOptions return elasticSearchClientOptions
} }