You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/06/08 11:30:40 UTC

[GitHub] [incubator-inlong] pocozh commented on a diff in pull request #4595: [INLONG-4594][Audit] Make Elasticsearch authentication configurable

pocozh commented on code in PR #4595:
URL: https://github.com/apache/incubator-inlong/pull/4595#discussion_r892245035


##########
inlong-audit/audit-store/src/main/java/org/apache/inlong/audit/config/ElasticsearchConfig.java:
##########
@@ -83,14 +86,27 @@ public class ElasticsearchConfig {
     @Value("${elasticsearch.auditIdSet}")
     private String auditIdSet;
 
-    @Bean(destroyMethod = "close",name = "restClient")
+    @Bean(destroyMethod = "close", name = "restClient")
     public RestHighLevelClient initRestClient() {
 
-        final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
-        credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
-        RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost(host, port, "http"))
-                .setHttpClientConfigCallback(httpAsyncClientBuilder ->
-                        httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider));
+        // support es cluster with multi hosts
+        List<HttpHost> hosts = new ArrayList<>();
+        String[] hostArrays = host.split(",");
+        for (String h : hostArrays) {

Review Comment:
   okay



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org