You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2020/03/23 12:42:12 UTC

[incubator-streampipes] branch dev updated: STREAMPIPES-102: Pipeline Element config updates via UI add key entry to consul

This is an automated email from the ASF dual-hosted git repository.

wiener pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new c1d19e9  STREAMPIPES-102: Pipeline Element config updates via UI add key entry to consul
c1d19e9 is described below

commit c1d19e959537745077874ecdcfbcc8f536d6c054
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Mon Mar 23 13:40:46 2020 +0100

    STREAMPIPES-102: Pipeline Element config updates via UI add key entry to consul
---
 .../src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java
index d4e1061..b3b834e 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java
@@ -21,6 +21,7 @@ package org.apache.streampipes.rest.impl;
 import static org.apache.streampipes.container.util.ConsulUtil.updateConfig;
 
 import com.google.gson.Gson;
+import com.google.gson.JsonObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.streampipes.config.backend.BackendConfig;
@@ -137,7 +138,9 @@ public class ConsulConfig extends AbstractRestInterface implements IConsulConfig
     String prefix = peConfig.getMainKey();
 
     for (ConfigItem configItem : peConfig.getConfigs()) {
-      updateConfig(configItem.getKey(), new Gson().toJson(configItem),
+      JsonObject jsonObj = new Gson().toJsonTree(configItem).getAsJsonObject();
+      jsonObj.entrySet().removeIf(e -> e.getKey().equals("key"));
+      updateConfig(configItem.getKey(), jsonObj.toString(),
               configItem.isPassword());
     }
     return Response.status(Response.Status.OK).build();