You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampark.apache.org by be...@apache.org on 2022/12/15 16:30:38 UTC

[incubator-streampark] branch dev updated: [Bug] get param from application config bug fixed. (#2165)

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

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


The following commit(s) were added to refs/heads/dev by this push:
     new bc2dab521 [Bug] get param from application config bug fixed. (#2165)
bc2dab521 is described below

commit bc2dab5211147aa7d9c72bbe29071f93bc2c16c0
Author: benjobs <be...@apache.org>
AuthorDate: Fri Dec 16 00:30:32 2022 +0800

    [Bug] get param from application config bug fixed. (#2165)
    
    * [Bug] streampark-console get param from application config bug fixed.
    
    * [Bug] dockerFile project dist path bug fixed
---
 deploy/docker/console/Dockerfile                   |  5 ++--
 .../console/core/entity/ApplicationConfig.java     | 35 +++++++++++++++++++---
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/deploy/docker/console/Dockerfile b/deploy/docker/console/Dockerfile
index d5697ff92..bf7fd34a8 100644
--- a/deploy/docker/console/Dockerfile
+++ b/deploy/docker/console/Dockerfile
@@ -18,9 +18,8 @@
 FROM alpine:3.16 as deps-stage
 COPY . /
 WORKDIR /
-RUN tar zxvf streampark-console/streampark-console-service/target/streampark-console-service-*.tar.gz \
-&& mv streampark-console-service-* streampark
-
+RUN tar zxvf streampark-console/streampark-console-service/target/apache-streampark_*-*-bin.tar.gz \
+&& mv apache-streampark_*-*-bin streampark
 
 FROM docker:dind
 WORKDIR /streampark
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/ApplicationConfig.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/ApplicationConfig.java
index aa8e5d044..758ccf443 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/ApplicationConfig.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/ApplicationConfig.java
@@ -17,6 +17,7 @@
 
 package org.apache.streampark.console.core.entity;
 
+import org.apache.streampark.common.conf.ConfigConst;
 import org.apache.streampark.common.util.DeflaterUtils;
 import org.apache.streampark.common.util.PropertiesUtils;
 import org.apache.streampark.console.core.enums.ConfigFileType;
@@ -33,6 +34,7 @@ import java.util.Base64;
 import java.util.Collections;
 import java.util.Date;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Data
 @TableName("t_flink_config")
@@ -78,18 +80,43 @@ public class ApplicationConfig {
 
     public Map<String, String> readConfig() {
         ConfigFileType fileType = ConfigFileType.of(this.format);
+        Map<String, String> configs = null;
         if (fileType != null) {
             switch (fileType) {
                 case YAML:
-                    return PropertiesUtils.fromYamlTextAsJava(DeflaterUtils.unzipString(this.content));
+                    configs = PropertiesUtils.fromYamlTextAsJava(DeflaterUtils.unzipString(this.content));
+                    break;
                 case PROPERTIES:
-                    return PropertiesUtils.fromPropertiesTextAsJava(DeflaterUtils.unzipString(this.content));
+                    configs = PropertiesUtils.fromPropertiesTextAsJava(DeflaterUtils.unzipString(this.content));
+                    break;
                 case HOCON:
-                    return PropertiesUtils.fromHoconTextAsJava(DeflaterUtils.unzipString(this.content));
+                    configs = PropertiesUtils.fromHoconTextAsJava(DeflaterUtils.unzipString(this.content));
+                    break;
                 default:
-                    return Collections.emptyMap();
+                    configs = Collections.emptyMap();
+                    break;
             }
         }
+
+        if (configs != null && !configs.isEmpty()) {
+            return configs.entrySet().stream().collect(
+                Collectors.toMap(entry -> {
+                    String key = entry.getKey();
+                    if (key.startsWith(ConfigConst.KEY_FLINK_OPTION_PREFIX())) {
+                        key = key.substring(ConfigConst.KEY_FLINK_OPTION_PREFIX().length());
+                    } else if (key.startsWith(ConfigConst.KEY_FLINK_PROPERTY_PREFIX())) {
+                        key = key.substring(ConfigConst.KEY_FLINK_PROPERTY_PREFIX().length());
+                    } else if (key.startsWith(ConfigConst.KEY_FLINK_TABLE_PREFIX())) {
+                        key = key.substring(ConfigConst.KEY_FLINK_TABLE_PREFIX().length());
+                    } else if (key.startsWith(ConfigConst.KEY_APP_PREFIX())) {
+                        key = key.substring(ConfigConst.KEY_APP_PREFIX().length());
+                    } else if (key.startsWith(ConfigConst.KEY_SQL_PREFIX())) {
+                        key = key.substring(ConfigConst.KEY_SQL_PREFIX().length());
+                    }
+                    return key;
+                }, Map.Entry::getValue)
+            );
+        }
         return Collections.emptyMap();
     }