diff --git a/server/.env.sample b/server/.env.sample index a238994..aaa4f3f 100644 --- a/server/.env.sample +++ b/server/.env.sample @@ -1,6 +1,9 @@ # Server port DISPLAY_SERVER_PORT=3030 +# Require Tor for outside API calls +DISPLAY_FORCE_TOR=false + # Bitcoin RPC credentials for getting the blockcount. # Omit these setting to use blockchain.info as a fallback. # DISPLAY_BITCOIN_RPC_USER="bitcoin-rpc-user" diff --git a/server/data.sh b/server/data.sh index 84c0b1e..435d960 100755 --- a/server/data.sh +++ b/server/data.sh @@ -13,6 +13,10 @@ torCheck=$(torsocks curl -s https://check.torproject.org/ 2>/dev/null | grep -c if [ ${torCheck} -gt 0 ]; then tor="torsocks" fi +if [[ -z "${tor}" && ${DISPLAY_FORCE_TOR} = true ]]; then + echo >&2 'Tor is required, but not available.' + exit 1 +fi # Get block height using RPC connection or Blockchain.info as fallback if [[ "${DISPLAY_BITCOIN_RPC_USER}" && "${DISPLAY_BITCOIN_RPC_PASS}" ]]; then