You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/11/09 06:52:15 UTC

[dubbo] branch 3.0 updated: [3.0] Ignore configFile get from dynamicConfiguration if disabled (#9241)

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

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 3b9d6af  [3.0] Ignore configFile get from dynamicConfiguration if disabled (#9241)
3b9d6af is described below

commit 3b9d6af35a75a3af0a073080a169c678438cd73e
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Tue Nov 9 14:51:57 2021 +0800

    [3.0] Ignore configFile get from dynamicConfiguration if disabled (#9241)
---
 .../config/deploy/DefaultApplicationDeployer.java  | 31 +++++++++++-----------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
index 5c89f57..cf6f24b 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
@@ -698,21 +698,22 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
                 }
             }
 
-            String configContent = dynamicConfiguration.getProperties(configCenter.getConfigFile(), configCenter.getGroup());
-
-            String appGroup = getApplication().getName();
-            String appConfigContent = null;
-            if (isNotEmpty(appGroup)) {
-                appConfigContent = dynamicConfiguration.getProperties
-                    (isNotEmpty(configCenter.getAppConfigFile()) ? configCenter.getAppConfigFile() : configCenter.getConfigFile(),
-                        appGroup
-                    );
-            }
-            try {
-                environment.updateExternalConfigMap(parseProperties(configContent));
-                environment.updateAppExternalConfigMap(parseProperties(appConfigContent));
-            } catch (IOException e) {
-                throw new IllegalStateException("Failed to parse configurations from Config Center.", e);
+            if (StringUtils.isNotEmpty(configCenter.getConfigFile())) {
+                String configContent = dynamicConfiguration.getProperties(configCenter.getConfigFile(), configCenter.getGroup());
+                String appGroup = getApplication().getName();
+                String appConfigContent = null;
+                if (isNotEmpty(appGroup)) {
+                    appConfigContent = dynamicConfiguration.getProperties
+                        (isNotEmpty(configCenter.getAppConfigFile()) ? configCenter.getAppConfigFile() : configCenter.getConfigFile(),
+                            appGroup
+                        );
+                }
+                try {
+                    environment.updateExternalConfigMap(parseProperties(configContent));
+                    environment.updateAppExternalConfigMap(parseProperties(appConfigContent));
+                } catch (IOException e) {
+                    throw new IllegalStateException("Failed to parse configurations from Config Center.", e);
+                }
             }
             return dynamicConfiguration;
         }