Skip to content

Commit b92df9f

Browse files
fix: simplify emulator configuration to use single port for both HTTP and gRPC
Co-Authored-By: Rushil Srivastava <[email protected]>
1 parent 21a5792 commit b92df9f

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

start-emulator.sh

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
#!/bin/sh
22
set -e
33

4-
# Start socat in the background to forward external connections
5-
socat TCP-LISTEN:8123,fork,reuseaddr,bind=0.0.0.0 TCP:127.0.0.1:8124 &
6-
SOCAT_PID=$!
7-
8-
# Start emulator on internal port with gRPC binding
9-
/emulator -host 0.0.0.0 -port 8124 -grpc_port 8124 -grpc_host 0.0.0.0 &
4+
# Start emulator binding to all interfaces
5+
/emulator -host 0.0.0.0 -port 8123 -grpc_port 8123 &
106
EMULATOR_PID=$!
117

128
# Function to cleanup processes
139
cleanup() {
14-
kill $SOCAT_PID $EMULATOR_PID 2>/dev/null || true
10+
kill $EMULATOR_PID 2>/dev/null || true
1511
}
1612

1713
# Set up trap
1814
trap cleanup EXIT
1915

2016
# Wait for emulator to be ready
2117
for i in $(seq 1 30); do
22-
if curl -s http://127.0.0.1:8124/v1/projects/test-project/locations/us-central1/queues > /dev/null; then
23-
echo "Emulator is ready on internal port!"
24-
if curl -s http://localhost:8123/v1/projects/test-project/locations/us-central1/queues > /dev/null; then
25-
echo "Emulator is accessible on external port!"
26-
break
27-
fi
18+
if curl -s http://127.0.0.1:8123/v1/projects/test-project/locations/us-central1/queues > /dev/null; then
19+
echo "Emulator is ready!"
20+
break
2821
fi
2922
echo "Waiting for emulator... attempt $i"
3023
sleep 1

0 commit comments

Comments
 (0)