ngrok.sh (625B)
1 #!/usr/bin/env bash 2 3 # Start serve in background 4 scripts/serve.sh & 5 SERVE_PID=$! 6 7 # Wait for server to be ready 8 sleep 2 9 10 # Start ngrok in background 11 ngrok http 3000 & 12 NGROK_PID=$! 13 14 # Wait for ngrok to be ready 15 sleep 2 16 17 # Configure via the tunnel 18 curl -X POST \ 19 "$(curl -s http://127.0.0.1:4040/api/tunnels | grep -oE 'https://[^"]+')/configure" \ 20 -d "twilioAccountSid=$TWILIO_ACCOUNT_SID&twilioPhoneNumberSid=$TWILIO_PHONE_NUMBER_SID&twilioAuthToken=$TWILIO_AUTH_TOKEN" 21 22 # Trap to kill background processes on script exit 23 trap "kill $NGROK_PID $SERVE_PID" EXIT 24 25 # Wait for background processes 26 wait $NGROK_PID $SERVE_PID