import java.util.List;
+import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.springframework.stereotype.Component;
HealthClient healthClient = consul.healthClient();
nodes = healthClient.getHealthyServiceInstances(service).getResponse();
} catch (Exception e) {
- String localFallbackServiceLocation = "localhost:" + fallbackPortOnLocalHost;
+ String localFallbackServiceLocation = EcompPortalUtils.localOrDockerHost() + ":" + fallbackPortOnLocalHost;
logger.debug(EELFLoggerDelegate.debugLogger,
" problem getting nodes for service {1}. Defaulting to {2}. Exception: {3}", service,
localFallbackServiceLocation, e.getMessage());
if (nodes == null || nodes.size() == 0) {
logger.debug(EELFLoggerDelegate.debugLogger, "No healthy node found in the consul cluster running service " + service
+ ". Defaulting to localhost");
- return "localhost:" + fallbackPortOnLocalHost;
+ return EcompPortalUtils.localOrDockerHost() + ":" + fallbackPortOnLocalHost;
} else {
String locationFromConsul;
ServiceHealth node = nodes.get(0);