diff --git a/apollo-adminservice/pom.xml b/apollo-adminservice/pom.xml index 748f4fbad42b4c5f3a17f7c96f4c8a907bd484df..8b1cf19a9ddf53b71e4d3a19995aa856e2cea66b 100644 --- a/apollo-adminservice/pom.xml +++ b/apollo-adminservice/pom.xml @@ -4,7 +4,7 @@ com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT ../pom.xml 4.0.0 diff --git a/apollo-assembly/pom.xml b/apollo-assembly/pom.xml index 720dd588c2328c115b2c00b8b8a2722160e36b00..eeaa03d931ff3de2186f0601965c184423229195 100644 --- a/apollo-assembly/pom.xml +++ b/apollo-assembly/pom.xml @@ -4,7 +4,7 @@ com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT ../pom.xml 4.0.0 diff --git a/apollo-biz/pom.xml b/apollo-biz/pom.xml index 1a8e730bda9fee4c7747c03dcad987d7f2ce08c7..ea180b329c3c07c0c20bddc3a7492e39579ce76a 100644 --- a/apollo-biz/pom.xml +++ b/apollo-biz/pom.xml @@ -4,7 +4,7 @@ apollo com.ctrip.framework.apollo - 0.1.1 + 0.1.2-SNAPSHOT 4.0.0 apollo-biz diff --git a/apollo-buildtools/pom.xml b/apollo-buildtools/pom.xml index 177dad992d6cdec17daf2115df45c428f6bb33fe..c477d299650f78a4399fb6a8a1d2a59362c03651 100644 --- a/apollo-buildtools/pom.xml +++ b/apollo-buildtools/pom.xml @@ -4,7 +4,7 @@ com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT ../pom.xml 4.0.0 diff --git a/apollo-client/pom.xml b/apollo-client/pom.xml index 2dedd7e4370ef3c8adc4ed813cd1307708271a07..2120fe4bee535112c7850933b33b62f1b81758b1 100644 --- a/apollo-client/pom.xml +++ b/apollo-client/pom.xml @@ -4,7 +4,7 @@ com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT ../pom.xml 4.0.0 diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/util/ConfigUtil.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/util/ConfigUtil.java index 65fab1eb87e5695d0928d113d193384671bbd753..90bd8352004ac59ee7c8a3e8cb1e771251be8e57 100644 --- a/apollo-client/src/main/java/com/ctrip/framework/apollo/util/ConfigUtil.java +++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/util/ConfigUtil.java @@ -7,9 +7,7 @@ import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.MetaDomainConsts; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.core.enums.EnvUtils; -import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.foundation.Foundation; -import com.dianping.cat.Cat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,6 +21,7 @@ import java.util.concurrent.TimeUnit; @Named(type = ConfigUtil.class) public class ConfigUtil { private static final Logger logger = LoggerFactory.getLogger(ConfigUtil.class); + private static final String TOOLS_CLUSTER = "TOOLS"; private int refreshInterval = 5; private TimeUnit refreshIntervalTimeUnit = TimeUnit.MINUTES; private int connectTimeout = 1000; //1 second @@ -66,6 +65,11 @@ public class ConfigUtil { //Load data center from system property cluster = System.getProperty(ConfigConsts.APOLLO_CLUSTER_KEY); + //Use TOOLS cluster if tools=true in server.properties + if (Strings.isNullOrEmpty(cluster) && isToolingZone()) { + cluster = TOOLS_CLUSTER; + } + //Use data center as cluster if (Strings.isNullOrEmpty(cluster)) { cluster = getDataCenter(); @@ -77,6 +81,13 @@ public class ConfigUtil { } } + private boolean isToolingZone() { + if ("true".equalsIgnoreCase(Foundation.server().getProperty("tools", "false").trim())) { + return true; + } + return false; + } + /** * Get the cluster name for the current application. * diff --git a/apollo-common/pom.xml b/apollo-common/pom.xml index 3c25735ab1e888ec04f4c8074df117e346b441ee..557c1dfe4b6ed8a9c4cc6e807563100efe3d2175 100644 --- a/apollo-common/pom.xml +++ b/apollo-common/pom.xml @@ -4,7 +4,7 @@ com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT ../pom.xml 4.0.0 diff --git a/apollo-configservice/pom.xml b/apollo-configservice/pom.xml index 4df8b838b367590f1f60b3582918107a67bf35ea..c198f0d7cbbdc157ffb9eedb0876ff1e329e1951 100644 --- a/apollo-configservice/pom.xml +++ b/apollo-configservice/pom.xml @@ -4,7 +4,7 @@ com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT ../pom.xml 4.0.0 diff --git a/apollo-core/pom.xml b/apollo-core/pom.xml index e47a754fe7760a7e973f38bf5e0df5dcff212330..22c82fb73bcc4128cf28ab4b2114a9295b8ef307 100644 --- a/apollo-core/pom.xml +++ b/apollo-core/pom.xml @@ -4,7 +4,7 @@ com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT ../pom.xml 4.0.0 diff --git a/apollo-demo/pom.xml b/apollo-demo/pom.xml index 36808b928ea77ec51677840c43c09efefbe6f4f6..fab43fb544e199f18c49d47266812e61e3e0424f 100644 --- a/apollo-demo/pom.xml +++ b/apollo-demo/pom.xml @@ -4,7 +4,7 @@ apollo com.ctrip.framework.apollo - 0.1.1 + 0.1.2-SNAPSHOT 4.0.0 apollo-demo diff --git a/apollo-demo/src/main/java/ApolloConfigDemo.java b/apollo-demo/src/main/java/ApolloConfigDemo.java index cd0e90f896c80a4b4c1e37082fd8f90f469692b1..63b9c0e3d65a54ac3604261e009bbf3500a8f5d5 100644 --- a/apollo-demo/src/main/java/ApolloConfigDemo.java +++ b/apollo-demo/src/main/java/ApolloConfigDemo.java @@ -7,6 +7,7 @@ import com.ctrip.framework.apollo.ConfigService; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.model.ConfigChange; import com.ctrip.framework.apollo.model.ConfigChangeEvent; +import com.ctrip.framework.foundation.Foundation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,8 +77,16 @@ public class ApolloConfigDemo { System.out.println(configFile.getContent()); } + private void printEnvInfo() { + String message = String.format("AppId: %s, Env: %s, DC: %s, IP: %s", Foundation.app() + .getAppId(), Foundation.server().getEnvType(), Foundation.server().getDataCenter(), + Foundation.net().getHostAddress()); + System.out.println(message); + } + public static void main(String[] args) throws IOException { ApolloConfigDemo apolloConfigDemo = new ApolloConfigDemo(); + apolloConfigDemo.printEnvInfo(); System.out.println( "Apollo Config Demo. Please input key to get the value."); while (true) { diff --git a/apollo-portal/pom.xml b/apollo-portal/pom.xml index 4ce506894594ba4b617876147a13ae9e465ee650..4563b13d195cddea6e4906113b2563c081a228aa 100644 --- a/apollo-portal/pom.xml +++ b/apollo-portal/pom.xml @@ -4,7 +4,7 @@ com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT ../pom.xml 4.0.0 diff --git a/pom.xml b/pom.xml index f299cdec4ff84228e4837f2d8a78e96041cda599..7f24b80251102566d81cfc31e1f5e7276c65e532 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.ctrip.framework.apollo apollo - 0.1.1 + 0.1.2-SNAPSHOT Apollo pom Ctrip Configuration Center