-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-heroku.sh
More file actions
executable file
·40 lines (30 loc) · 916 Bytes
/
test-heroku.sh
File metadata and controls
executable file
·40 lines (30 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
cleanup() {
echo "Cleaning up..."
if [[ -n "$heroku_pid" ]]; then
kill -SIGTERM "$heroku_pid" 2>/dev/null
fi
}
./cloudpipe heroku &
heroku_pid=$!
echo "Heroku process started with PID $consumer_pid"
trap cleanup EXIT
sleep 1
heroku=http://localhost:8002
# create the backend pipe
curl -X POST -u foo:bar $heroku/cloudpipe-backend/pipes -H "Content-Type: application/json" -d '
{
"id":"to_frontend"
}
'
curl -u foo:bar $heroku/cloudpipe-backend/pipes/to_frontend | jq .
# get the uri value from the pipe
uri=`curl -u foo:bar $heroku/cloudpipe-backend/pipes/to_frontend | jq -r .this.data.URI`
# create the frontend pipe
curl -X POST -u foo:bar $heroku/cloudpipe-frontend/pipes -H "Content-Type: application/json" -d "
{
\"id\":\"to_backend\",
\"other\": {\"data\":{\"URI\":\"$uri\"}}
}
"
curl -u foo:bar $heroku/cloudpipe-frontend/pipes/to_backend | jq .