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:38:06 UTC

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

wu-sheng 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_r390880429
 
 

 ##########
 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:
   Was thinking about this. But not sure. Does across Thread cache will keep forever? Because we are not sensitive this changed immediately, several seconds later is fine.
   What do you think about this?

----------------------------------------------------------------
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