#!/bin/bash
set -e

adb start-server

if [ -n "$ADB_DEVICE_HOST" ]; then
  echo "Connecting to ADB device at $ADB_DEVICE_HOST:${ADB_DEVICE_PORT:-5555}"
  adb connect "$ADB_DEVICE_HOST:${ADB_DEVICE_PORT:-5555}"
  sleep 2
  adb devices
fi

exec node index.js
