From 4d9c5d2e9f3581900d802049ac6b23ba31caa9c4 Mon Sep 17 00:00:00 2001 From: Diwank Singh Tomer Date: Mon, 9 Sep 2024 14:19:25 -0400 Subject: [PATCH] fix(agents-api): Add protocol to vars Signed-off-by: Diwank Singh Tomer --- .env.example | 3 ++- agents-api/agents_api/env.py | 1 + agents-api/agents_api/web.py | 2 +- agents-api/docker-compose.yml | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 31a967395..fc2bdd7fb 100644 --- a/.env.example +++ b/.env.example @@ -28,6 +28,7 @@ EMBEDDING_SERVICE_BASE=http://text-embeddings-inference- # Use the 'gp # --------- # AGENTS_API_HOSTNAME=localhost +# AGENTS_API_PROTOCOL=http # AGENTS_API_KEY_HEADER_NAME=Authorization # AGENTS_API_URL=http://agents-api:8080 # TRUNCATE_EMBED_TEXT=true @@ -66,4 +67,4 @@ EMBEDDING_SERVICE_BASE=http://text-embeddings-inference- # Use the 'gp # NVIDIA_NIM_API_KEY= # GITHUB_API_KEY= # VOYAGE_API_KEY= -# GOOGLE_APPLICATION_CREDENTIALS=.keys/julep-vertexai-svc.json \ No newline at end of file +# GOOGLE_APPLICATION_CREDENTIALS=.keys/julep-vertexai-svc.json diff --git a/agents-api/agents_api/env.py b/agents-api/agents_api/env.py index fc388687a..aa2254e51 100644 --- a/agents-api/agents_api/env.py +++ b/agents-api/agents_api/env.py @@ -15,6 +15,7 @@ # App # --- multi_tenant_mode: bool = env.bool("AGENTS_API_MULTI_TENANT_MODE", default=False) +protocol: str = env.str("AGENTS_API_PROTOCOL", default="http") hostname: str = env.str("AGENTS_API_HOSTNAME", default="localhost") public_port: int = env.int("AGENTS_API_PUBLIC_PORT", default=80) api_prefix: str = env.str("AGENTS_API_PREFIX", default="") diff --git a/agents-api/agents_api/web.py b/agents-api/agents_api/web.py index 460dc2b86..095de1202 100644 --- a/agents-api/agents_api/web.py +++ b/agents-api/agents_api/web.py @@ -108,7 +108,7 @@ async def scalar_html(): return get_scalar_api_reference( openapi_url=app.openapi_url[1:], # Remove leading '/' title=app.title, - servers=[{"url": f"http://{hostname}:{public_port}{api_prefix}"}], + servers=[{"url": f"{protocol}://{hostname}:{public_port}{api_prefix}"}], ) diff --git a/agents-api/docker-compose.yml b/agents-api/docker-compose.yml index 133337126..f1f00e18f 100644 --- a/agents-api/docker-compose.yml +++ b/agents-api/docker-compose.yml @@ -5,6 +5,7 @@ x--shared-environment: &shared-environment AGENTS_API_KEY: ${AGENTS_API_KEY} AGENTS_API_KEY_HEADER_NAME: ${AGENTS_API_KEY_HEADER_NAME:-Authorization} AGENTS_API_HOSTNAME: ${AGENTS_API_HOSTNAME:-localhost} + AGENTS_API_PROTOCOL: ${AGENTS_API_PROTOCOL:-http} AGENTS_API_URL: ${AGENTS_API_URL:-http://agents-api:8080} COZO_AUTH_TOKEN: ${COZO_AUTH_TOKEN} COZO_HOST: ${COZO_HOST:-http://memory-store:9070} @@ -107,4 +108,4 @@ services: path: ./migrations target: /app/migrations - action: rebuild - path: Dockerfile.migration \ No newline at end of file + path: Dockerfile.migration