import org.slf4j.LoggerFactory;\r
\r
import static org.onap.holmes.common.utils.CommonUtils.getEnv;\r
-import static org.onap.holmes.common.utils.CommonUtils.isIpAddress;\r
\r
public class MicroServiceConfig {\r
\r
}\r
\r
public static String[] getMicroServiceIpAndPort() {\r
- String[] serviceAddrInfo = null;\r
- String info = getServiceAddrInfoFromDcaeConsulByHostName(getEnv(HOSTNAME));\r
- log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from Consul. The response is " + info + ".");\r
-\r
- if (info != null && !info.isEmpty()) {\r
- if (!isIpAddress(info)) {\r
- info = getEnv(POD_IP);\r
- }\r
- serviceAddrInfo = split(info);\r
+ String info = getEnv(POD_IP);\r
+ if (info != null) {\r
+ return split(info);\r
} else {\r
- serviceAddrInfo = split(getEnv(HOSTNAME));\r
+ return split(getEnv(HOSTNAME));\r
}\r
- return serviceAddrInfo;\r
}\r
\r
-\r
private static String[] split(String addr) {\r
String ip;\r
String port = "80";\r