This is an automated email from the ASF dual-hosted git repository.

mhamann pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-openwhisk-apigateway.git


The following commit(s) were added to refs/heads/master by this push:
     new f2c9665  add PUBLIC_MANAGEDURL_CONNECT to override HOST:PORT 
assumption (#269)
f2c9665 is described below

commit f2c9665059e669c110cd5b60e357f4b3dc55456f
Author: David Grove <dgrove-...@users.noreply.github.com>
AuthorDate: Wed Dec 20 21:34:48 2017 -0500

    add PUBLIC_MANAGEDURL_CONNECT to override HOST:PORT assumption (#269)
    
    * add PUBLIC_MANAGEDURL_CONNECT to override HOST:PORT assumption
    
    Add optional override to assuming that the managed URL can be
    constructed simply by concatenating a HOST and PORT pair as HOST:PORT.
    This is needed for deployments where multiple services are hosted
    using URL rewriting on a single host.
    
    * address review feedback
    
    rename PUBLIC_MANAGEDURL_CONNECT to PUBLIC_GATEWAY_URL and do not
    hardwire http protocol for PUBLIC_GATEWAY_URL
---
 api-gateway.conf                    | 1 +
 scripts/lua/management/lib/apis.lua | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/api-gateway.conf b/api-gateway.conf
index ecf7b22..f82e06f 100644
--- a/api-gateway.conf
+++ b/api-gateway.conf
@@ -31,6 +31,7 @@ env REDIS_PASS;
 env REDIS_TIMEOUT;
 env PUBLIC_MANAGEDURL_HOST;
 env PUBLIC_MANAGEDURL_PORT;
+env PUBLIC_GATEWAY_URL;
 env HOST;
 env PORT;
 
diff --git a/scripts/lua/management/lib/apis.lua 
b/scripts/lua/management/lib/apis.lua
index c27564e..04161f2 100644
--- a/scripts/lua/management/lib/apis.lua
+++ b/scripts/lua/management/lib/apis.lua
@@ -27,6 +27,8 @@ local MANAGEDURL_HOST = os.getenv("PUBLIC_MANAGEDURL_HOST")
 MANAGEDURL_HOST = (MANAGEDURL_HOST ~= nil and MANAGEDURL_HOST ~= '') and 
MANAGEDURL_HOST or "0.0.0.0"
 local MANAGEDURL_PORT = os.getenv("PUBLIC_MANAGEDURL_PORT")
 MANAGEDURL_PORT = (MANAGEDURL_PORT ~= nil and MANAGEDURL_PORT ~= '') and 
MANAGEDURL_PORT or "8080"
+local GATEWAY_URL = os.getenv("PUBLIC_GATEWAY_URL")
+GATEWAY_URL = (GATEWAY_URL ~= nil and GATEWAY_URL ~= '') and GATEWAY_URL or 
utils.concatStrings({"http://";, MANAGEDURL_HOST, ":", MANAGEDURL_PORT})
 
 local _M = {}
 
@@ -87,7 +89,7 @@ function _M.addAPI(dataStore, decoded, existingAPI)
   basePath = basePath:sub(-1) == '/' and basePath:sub(1, -2) or basePath
   -- Create managedUrl object
   local uuid = existingAPI ~= nil and existingAPI.id or utils.uuid()
-  local managedUrl = utils.concatStrings({"http://";, MANAGEDURL_HOST, ":", 
MANAGEDURL_PORT, "/api/", decoded.tenantId})
+  local managedUrl = utils.concatStrings({GATEWAY_URL, "/api/", 
decoded.tenantId})
   if basePath:sub(1,1) ~= '' then
     managedUrl = utils.concatStrings({managedUrl, "/", basePath})
   end

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Reply via email to