abaruni commented on a change in pull request #286: Fix for overriding api host
URL:
https://github.com/apache/incubator-openwhisk-package-kafka/pull/286#discussion_r218926147
##########
File path: provider/consumer.py
##########
@@ -213,18 +213,29 @@ def secondsSinceLastPoll(self):
return secondsSince(self.lastPoll())
def __triggerURL(self, originalURL):
+ parsed = urlparse(originalURL)
apiHost = os.getenv('API_HOST')
if apiHost is not None:
logging.info('[{}] Environment variable defined for API_HOST.
Overriding host value defined for trigger in DB with {}'.format(self.trigger,
apiHost))
- parsed = urlparse(originalURL)
- parts = parsed.netloc.split('@')
- auth = parts[0]
- newURL = parsed._replace(netloc='{}@{}'.format(auth, apiHost))
+ newURL = parsed._replace(netloc=apiHost)
return newURL.geturl()
else:
- return originalURL
+ # remove https://user:pass@host from url and replace it with just
https://host
+ # we do this because we no longer need the basic auth in the url
itself.
+ # we rely upon the HTTPBasicAuth handler or the IAMAuth handler
+ parts = parsed.netloc.split('@')
+
+ if len(parts) == 2:
+ host = parts[1]
+ else:
+ host = parts[0]
+
Review comment:
we want to maintain backward compatibility with trigger docs that have the
user:pass in the url itself. but since we are using an auth handler we want to
remove it from the url if it has it
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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