You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/03/11 10:34:04 UTC

[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #4493: Support Secrets Management File in the ElasticSearch 6/7 storage

kezhenxu94 commented on a change in pull request #4493: Support Secrets Management File in the ElasticSearch 6/7 storage
URL: https://github.com/apache/skywalking/pull/4493#discussion_r390877727
 
 

 ##########
 File path: oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/StorageModuleElasticsearchProvider.java
 ##########
 @@ -117,6 +120,31 @@ public void prepare() throws ServiceNotProvidedException {
         if (config.getDayStep() > 1) {
             TimeSeriesUtils.setDAY_STEP(config.getDayStep());
         }
+
+        if (!StringUtil.isEmpty(config.getSecretsManagementFile())) {
+            MultipleFilesChangeMonitor monitor = new MultipleFilesChangeMonitor(
+                10, readableContents -> {
+                    final byte[] secretsFileContent = readableContents.get(0);
+                    if (secretsFileContent == null) {
+                        return;
+                    }
+                    Properties userAndPass = new Properties();
+                    userAndPass.load(new ByteArrayInputStream(secretsFileContent));
+                    config.setUser(userAndPass.getProperty("user"));
+                    config.setPassword(userAndPass.getProperty("password"));
+
+                    if (elasticSearchClient == null) {
+                        //In the startup process, we just need to change the username/password
 
 Review comment:
   Make `elasticSearchClient` volatile?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services