use of com.ctrip.framework.apollo.core.enums.Env in project apollo by ctripcorp.
the class AppController method loadEnvClusterInfo.
@RequestMapping(value = "/apps/{appId}/envclusters", method = RequestMethod.GET)
public List<OpenEnvClusterDTO> loadEnvClusterInfo(@PathVariable String appId) {
List<OpenEnvClusterDTO> envClusters = new LinkedList<>();
List<Env> envs = portalSettings.getActiveEnvs();
for (Env env : envs) {
OpenEnvClusterDTO envCluster = new OpenEnvClusterDTO();
envCluster.setEnv(env.name());
List<ClusterDTO> clusterDTOs = clusterService.findClusters(env, appId);
envCluster.setClusters(BeanUtils.toPropertySet("name", clusterDTOs));
envClusters.add(envCluster);
}
return envClusters;
}
use of com.ctrip.framework.apollo.core.enums.Env in project apollo by ctripcorp.
the class ConfigUtil method getApolloEnv.
/**
* Get the current environment.
*
* @return the env
* @throws ApolloConfigException if env is set
*/
public Env getApolloEnv() {
Env env = EnvUtils.transformEnv(Foundation.server().getEnvType());
if (env == null) {
String path = isOSWindows() ? "C:\\opt\\settings\\server.properties" : "/opt/settings/server.properties";
String message = String.format("env is not set, please make sure it is set in %s!", path);
logger.error(message);
throw new ApolloConfigException(message);
}
return env;
}
use of com.ctrip.framework.apollo.core.enums.Env in project apollo by ctripcorp.
the class DefaultMetaServerProviderTest method testWithSystemProperty.
@Test
public void testWithSystemProperty() throws Exception {
String someMetaAddress = "someMetaAddress";
Env someEnv = Env.DEV;
System.setProperty(ConfigConsts.APOLLO_META_KEY, " " + someMetaAddress + " ");
DefaultMetaServerProvider defaultMetaServerProvider = new DefaultMetaServerProvider();
assertEquals(someMetaAddress, defaultMetaServerProvider.getMetaServerAddress(someEnv));
}
Aggregations