diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2020-07-28 20:55:41 -0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2020-07-28 20:55:41 -0300 |
commit | 4bde2de9cb6e9c2753c6eb18a523b2c92f341827 (patch) | |
tree | 49074f651c9d93dd44a0b2ef3498d63152346874 | |
parent | 125b7fa027b869b4054b7c3ec880086ff7d06854 (diff) | |
download | cloud_mdir_sync-4bde2de9cb6e9c2753c6eb18a523b2c92f341827.tar.gz cloud_mdir_sync-4bde2de9cb6e9c2753c6eb18a523b2c92f341827.tar.bz2 cloud_mdir_sync-4bde2de9cb6e9c2753c6eb18a523b2c92f341827.zip |
oauth: Extract the web server address from the setup URL
This lets the OAUTH module be used for other localhost ports too.
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-rw-r--r-- | cloud_mdir_sync/oauth.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cloud_mdir_sync/oauth.py b/cloud_mdir_sync/oauth.py index 385e0e8..dfa1987 100644 --- a/cloud_mdir_sync/oauth.py +++ b/cloud_mdir_sync/oauth.py @@ -13,6 +13,8 @@ import aiohttp.web import oauthlib import oauthlib.oauth2 +import urllib.parse + if TYPE_CHECKING: from . import config @@ -46,7 +48,8 @@ class WebServer(object): async def go(self): self.runner = aiohttp.web.AppRunner(self.web_app) await self.runner.setup() - site = aiohttp.web.TCPSite(self.runner, '127.0.0.1', 8080) + url = urllib.parse.urlparse(self.url) + site = aiohttp.web.TCPSite(self.runner, url.hostname, url.port) await site.start() async def close(self): |