Skip to content

Commit

Permalink
Feature: compatible with acm (apache#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangwengeek authored May 23, 2020
1 parent 6d309a5 commit 7c38bb0
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package io.seata.config.nacos;

import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
Expand All @@ -36,6 +37,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* The type Nacos configuration.
*
Expand All @@ -48,11 +50,14 @@ public class NacosConfiguration extends AbstractConfiguration {
private static final String DEFAULT_GROUP = "SEATA_GROUP";
private static final String GROUP_KEY = "group";
private static final String PRO_SERVER_ADDR_KEY = "serverAddr";
private static final String ENDPOINT_KEY = "endpoint";
private static final String CONFIG_TYPE = "nacos";
private static final String DEFAULT_NAMESPACE = "";
private static final String PRO_NAMESPACE_KEY = "namespace";
private static final String USER_NAME = "username";
private static final String PASSWORD = "password";
private static final String ACCESS_KEY = "accessKey";
private static final String SECRET_KEY = "secretKey";
private static final Configuration FILE_CONFIG = ConfigurationFactory.CURRENT_FILE_INSTANCE;
private static volatile ConfigService configService;
private static final int MAP_INITIAL_CAPACITY = 8;
Expand Down Expand Up @@ -176,7 +181,11 @@ public Set<ConfigurationChangeListener> getConfigListeners(String dataId) {

private static Properties getConfigProperties() {
Properties properties = new Properties();
if (null != System.getProperty(PRO_SERVER_ADDR_KEY)) {
if (null != System.getProperty(ENDPOINT_KEY)) {
properties.setProperty(ENDPOINT_KEY, System.getProperty(ENDPOINT_KEY));
properties.put(ACCESS_KEY, Objects.toString(System.getProperty(ACCESS_KEY), ""));
properties.put(SECRET_KEY, Objects.toString(System.getProperty(SECRET_KEY), ""));
} else if (null != System.getProperty(PRO_SERVER_ADDR_KEY)) {
properties.setProperty(PRO_SERVER_ADDR_KEY, System.getProperty(PRO_SERVER_ADDR_KEY));
} else {
String address = FILE_CONFIG.getConfig(getNacosAddrFileKey());
Expand Down

0 comments on commit 7c38bb0

Please sign in to comment.