X-Git-Url: https://gerrit.onap.org/r/gitweb?p=portal.git;a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fportalapp%2Fportal%2Futils%2FEcompPortalUtils.java;h=d471d90b18a5a4da08934bc6f836bb9e51014e44;hp=2b39da0afe2734523a88b2193bf7de4bee720cdb;hb=a9627f8c54b7e9d5712320621e8a0b748ad9baf4;hpb=134cb7f97684487cf8a0245617c339a3fe2d54b0 diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java index 2b39da0a..d471d90b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java @@ -354,5 +354,20 @@ public class EcompPortalUtils { return "https"; } } + + public static String localOrDockerHost(){ + final String effectiveHost; + try{ + effectiveHost = SystemProperties.getProperty(EPCommonSystemProperties.WIDGET_MS_HOSTNAME); + return (effectiveHost == null || effectiveHost.trim().equals("")) ? "localhost" : effectiveHost ; + } + catch(IllegalStateException ese){ + //looks like SystemProperties.getProperty throws IllegalStateException if it cannot find a property you are looking for + //In order to not break the code if a non-required property is missing from system.properties, returning https as default + //when this exception is caught. + return "localhost"; + } + } + }