diff --git a/src/core/app.py b/src/core/app.py index 1cd103a..123780b 100644 --- a/src/core/app.py +++ b/src/core/app.py @@ -73,7 +73,7 @@ async def register_routes(app: Application): relative_path = route["path"].lstrip("/") if relative_path not in existing_endpoints: service_data = { - "base_url": f"{config.WEATHER_SRV_HOSTNAME}:{config.WEATHER_SRV_PORT}", + "base_url": f"http://{config.WEATHER_SRV_HOSTNAME}:{config.WEATHER_SRV_PORT}/", "service_name": "weather_data", "endpoint": relative_path, "methods": route["methods"], diff --git a/src/core/config.py b/src/core/config.py index 7ecab05..14e197f 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -21,7 +21,6 @@ # GATEKEEPER GATEKEEPER_URL= os.environ.get('GATEKEEPER_URL', '') -GATEKEEPER_APP_PORT = os.environ.get('GATEKEEPER_APP_PORT', '8001') WEATHER_SRV_GATEKEEPER_USER = os.environ.get('WEATHER_SRV_GATEKEEPER_USER', '') WEATHER_SRV_GATEKEEPER_PASSWORD = os.environ.get('WEATHER_SRV_GATEKEEPER_PASSWORD', '') diff --git a/src/gatekeeper_utils.py b/src/gatekeeper_utils.py index d269689..180ea9d 100644 --- a/src/gatekeeper_utils.py +++ b/src/gatekeeper_utils.py @@ -11,7 +11,7 @@ async def gk_login() -> str: 'password': config.WEATHER_SRV_GATEKEEPER_PASSWORD } async with httpx.AsyncClient() as client: - url = f'{config.GATEKEEPER_URL}:{config.GATEKEEPER_APP_PORT}/api/login/' + url = f'{config.GATEKEEPER_URL}/api/login/' r = await client.post(url, data=login_credentials) r.raise_for_status() return (r.json()['access'], r.json()['refresh']) @@ -20,7 +20,7 @@ async def gk_login() -> str: # Logout to gatekeeper using credentials from config file async def gk_logout(refresh_token): async with httpx.AsyncClient() as client: - url = f'{config.GATEKEEPER_URL}:{config.GATEKEEPER_APP_PORT}/api/logout/' + url = f'{config.GATEKEEPER_URL}/api/logout/' r = await client.post(url, json={"refresh": refresh_token}) r.raise_for_status() return @@ -32,7 +32,7 @@ async def gk_service_directory(token: str) -> dict: headers = { "Authorization": f"Bearer {token}" } - r = await client.get(f'{config.GATEKEEPER_URL}:{config.GATEKEEPER_APP_PORT}/api/service_directory/', headers=headers) + r = await client.get(f'{config.GATEKEEPER_URL}/api/service_directory/', headers=headers) r.raise_for_status() return r.json() @@ -43,6 +43,6 @@ async def gk_service_register(token: str, service_data: dict) -> dict: headers = { "Authorization": f"Bearer {token}" } - r = await client.post(f'{config.GATEKEEPER_URL}:{config.GATEKEEPER_APP_PORT}/api/register_service/', headers=headers, json=service_data) + r = await client.post(f'{config.GATEKEEPER_URL}/api/register_service/', headers=headers, json=service_data) r.raise_for_status() return r.json() \ No newline at end of file