#!/usr/bin/sh
set -eu

case " ${NODE_OPTIONS-} " in
  *--inspect*|*--heap-prof*|*--heapsnapshot-*|*--report-*|*--diagnostic-dir*)
    echo "Unsafe Node.js debugging or diagnostic option is not allowed" >&2
    exit 2
    ;;
esac

for argument in "$@"; do
  case "$argument" in
    --inspect*|--heap-prof*|--heapsnapshot-*|--report-*|--diagnostic-dir*)
      echo "Unsafe Node.js debugging or diagnostic option is not allowed" >&2
      exit 2
      ;;
  esac
done

exec /usr/bin/node /usr/share/rgoon-sync/src/cli.js "$@"
