Skip to content

Commit 21476c5

Browse files
fix: update emulator client to handle host and port configuration separately
Co-Authored-By: Rushil Srivastava <[email protected]>
1 parent 12d556c commit 21476c5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fastapi_gcp_tasks/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def ensure_queue(
4646

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

0 commit comments

Comments
 (0)