Skip to content

Commit

Permalink
fix: update emulator client to handle host and port configuration sep…
Browse files Browse the repository at this point in the history
…arately

Co-Authored-By: Rushil Srivastava <[email protected]>
  • Loading branch information
1 parent 12d556c commit 21476c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fastapi_gcp_tasks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def ensure_queue(

def emulator_client() -> tasks_v2.CloudTasksClient:
"""Helper function to create a CloudTasksClient from an emulator host."""
host = os.getenv("CLOUD_TASKS_EMULATOR_HOST", "localhost:8124")
channel = grpc.insecure_channel(host)
host = os.getenv("CLOUD_TASKS_EMULATOR_HOST", "localhost")
port = os.getenv("CLOUD_TASKS_EMULATOR_PORT", "8123")
channel = grpc.insecure_channel(f"{host}:{port}")
transport = transports.CloudTasksGrpcTransport(channel=channel)
return tasks_v2.CloudTasksClient(transport=transport)

0 comments on commit 21476c5

Please sign in to comment.