package com.ctrip.apollo.core;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import com.ctrip.apollo.core.enums.Env;
import com.ctrip.apollo.core.utils.ResourceUtils;

/**
 * The meta domain will load the meta server from System environment first, if not exist, will load
 * from apollo-env.properties. If neither exists, will load the default meta url.
 * 
 * Currently, apollo supports local/dev/fat/uat/lpt/pro environments.
 */
@SuppressWarnings({"rawtypes", "unchecked"})
public class MetaDomainConsts {

  private static Map<Env, Object> domains = new HashMap<>();

  public static final String DEFAULT_META_URL = "http://localhost:8080";

  static {
    Properties prop = new Properties();
    prop = ResourceUtils.readConfigFile("apollo-env.properties", prop);
    Map env = System.getProperties();
    domains.put(Env.LOCAL,
        env.getOrDefault("local_meta", prop.getProperty("local.meta", DEFAULT_META_URL)));
    domains.put(Env.DEV,
        env.getOrDefault("dev_meta", prop.getProperty("dev.meta", DEFAULT_META_URL)));
    domains.put(Env.FAT,
        env.getOrDefault("fat_meta", prop.getProperty("fat.meta", DEFAULT_META_URL)));
    domains.put(Env.UAT,
        env.getOrDefault("uat_meta", prop.getProperty("uat.meta", DEFAULT_META_URL)));
    domains.put(Env.LPT,
        env.getOrDefault("lpt_meta", prop.getProperty("lpt.meta", DEFAULT_META_URL)));
    domains.put(Env.PRO,
        env.getOrDefault("pro_meta", prop.getProperty("pro.meta", DEFAULT_META_URL)));
  }

  public static String getDomain(Env env) {
    return String.valueOf(domains.get(env));
  }
}

@@ -462,53 +462,8 @@
  */%0A
-@SuppressWarnings(%7B%22rawtypes%22, %22unchecked%22%7D)%0A
 publ
@@ -754,19 +754,26 @@
 p);%0A    
-Map
+Properties
  env = S
@@ -837,25 +837,24 @@
  env.get
-OrDefault
+Property
 (%22local_
@@ -952,25 +952,24 @@
  env.get
-OrDefault
+Property
 (%22dev_me
@@ -1063,25 +1063,24 @@
  env.get
-OrDefault
+Property
 (%22fat_me
@@ -1174,25 +1174,24 @@
  env.get
-OrDefault
+Property
 (%22uat_me
@@ -1285,25 +1285,24 @@
  env.get
-OrDefault
+Property
 (%22lpt_me
@@ -1400,17 +1400,16 @@
 .get
-OrDefault
+Property
 (%22pr

Fix properties getDefault