-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enable overriding the backend url to enable standalone mode #347
Conversation
@@ -39,6 +40,11 @@ function _M.setRoute(backendUrl, gatewayPath) | |||
ngx.req.set_uri(getUriPath(u.path)) | |||
end | |||
ngx.var.backendUrl = backendUrl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's ok to not also change ngx.var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the ngx.var
also
@mrutkows @dgrove-oss The build is failing due to scancode issue reporting lots of trailing whitespace in code from downloaded lua modules. Anyway to fix scancode logic to exclude those files? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well. Many thanks for moving this ahead @chetanmeh !
@chetanmeh -- we can reorder travis to do the scancode before it installs lua. Do the scancode in preinstall stage. Do you want to do it as part of this PR, or do you want me to do a separate PR just for that? |
@dgrove-oss Please review the travis and build related changes once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@chetanmeh can you write some tests for this? we need to make sure that this doesn't break production use cases. I'm assuming it does not, but there are no test assertions proving that. |
a visual inspection shows all the changes are guarded by of course, adding tests ensures this new feature isn't broken in the future. |
Positive and negative tests are both needed (proving that both cases work as intended). While I agree that the code looks correct, I've been bitten plenty of times by code that looked fine visually, but had some nasty side-effect nobody noticed. |
This PR enables running api gateway with standalone server (apache/openwhisk#4571).
It also fixes current broken build by updating the
opm
versionImplementation Details
Api Gateway uses the backend url as computed by makeWebActionBackendUrl in
createApi
call. This backend url is based on url passed bywsk api
commandWith standalone case this url becomes
http://localhost:3233
and is used as is by api gateway routing logic. So to enable this flow to work thebackendRouting
logic now exposes a env variableBACKEND_HOST
. If this variable is found to be set then it supersedes the backend url as specified increateApi
call