forked from openwallet-foundation/acapy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ngrok-wait.sh
executable file
·31 lines (27 loc) · 1.06 KB
/
ngrok-wait.sh
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
#!/bin/bash
# based on code developed by Sovrin: https://github.com/hyperledger/aries-acapy-plugin-toolbox
# if a tails network is specified, there should be an associated ngrok as well ...
if ! [ -z "$TAILS_NGROK_NAME" ]; then
echo "ngrok tails service name [$TAILS_NGROK_NAME]"
NGROK_ENDPOINT=null
JQ=${JQ:-`which jq`}
if [ -x "$JQ" ]; then
while [ -z "$NGROK_ENDPOINT" ] || [ "$NGROK_ENDPOINT" = "null" ]
do
echo "Fetching endpoint from ngrok service"
NGROK_ENDPOINT=$(curl --silent $TAILS_NGROK_NAME:4040/api/tunnels | $JQ -r '.tunnels[0].public_url')
if [ -z "$NGROK_ENDPOINT" ] || [ "$NGROK_ENDPOINT" = "null" ]; then
echo "ngrok not ready, sleeping 5 seconds...."
sleep 5
fi
done
else
echo " not found"
fi
export PUBLIC_TAILS_URL=$NGROK_ENDPOINT
echo "Fetched ngrok tails server endpoint [$PUBLIC_TAILS_URL]"
fi
export AGENT_NAME=$1
shift
echo "Starting [$AGENT_NAME] agent with args [$@]"
python -m demo.runners.$AGENT_NAME $@