#!/bin/env bash
set -euo pipefail

[[ -n ${DEBUG:-} ]] && set -x

# Discard the leading subcommand argument (e.g. "cli") passed by the entrypoint
shift

if [[ -z ${CARDANO_NODE_SOCKET_PATH:-} ]]; then
  # Breaking change from the historical default of: /opt/cardano/ipc/socket
  # in order to align both the "scripts" and "custom" modes of image operation.
  export CARDANO_NODE_SOCKET_PATH="/ipc/node.socket"
fi

exec /usr/local/bin/cardano-cli "$@"
