sciabarra commented on a change in pull request #4782: A docker image for the 
standalone openwhisk
URL: https://github.com/apache/openwhisk/pull/4782#discussion_r361963022
 
 

 ##########
 File path: 
core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneDockerSupport.scala
 ##########
 @@ -105,29 +105,46 @@ object StandaloneDockerSupport {
     prefix + name
   }
 
+  /**
+   * Returns the hostname to access the playground.
+   * It defaults to localhost but it can be overriden
+   * and it is useful when the standalone is run in a container.
+   */
+  def getExternalHostName(): String = {
+    
sys.props.get("whisk.standalone.host.external").getOrElse(getLocalHostName())
+  }
+
   /**
    * Returns the address to be used by code running outside of container to 
connect to
    * server. On non linux setups its 'localhost'. However for Linux setups its 
the ip used
    * by docker for docker0 network to refer to host system
    */
   def getLocalHostName(): String = {
-    if (SystemUtils.IS_OS_LINUX) hostIpLinux
-    else "localhost"
+    sys.props
+      .get("whisk.standalone.host.name")
+      .getOrElse(if (SystemUtils.IS_OS_LINUX) hostIpLinux
+      else "localhost")
   }
 
   def getLocalHostIp(): String = {
-    if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_WINDOWS)
-      hostIpNonLinux
-    else hostIpLinux
+    sys.props
+      .get("whisk.standalone.host.ip")
 
 Review comment:
   No. But I added it for completeness. For example a scenario where you may 
want this in kubernetes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to