Skip to content

Commit

Permalink
Dynamically set BLOCK_EXPLORER_URL based on Bitcoin Node network
Browse files Browse the repository at this point in the history
  • Loading branch information
nmfretz authored and ShahanaFarooqui committed Jun 28, 2024
1 parent ed7e1f1 commit 09efd3f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ride-the-lightning/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
APP_PORT: 3001

web:
image: shahanafarooqui/rtl:v0.15.2@sha256:5473e45c18e86c479ac8e7485f06e7c31948d5dc0726306f3850cf8ee635cbcd
image: shahanafarooqui/rtl:v0.15.2@sha256:e2c40d04821a1a6e9bcb55b4276c428c6c416ab1c33b4efd256366430234ea6a
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
Expand All @@ -24,7 +24,7 @@ services:
RTL_CONFIG_PATH: "/data"
CHANNEL_BACKUP_PATH: "/data/backup"
LN_IMPLEMENTATION: "LND"
BLOCK_EXPLORER_URL: 'https://mempool.space'
BLOCK_EXPLORER_URL: "${APP_RTL_BLOCK_EXPLORER_URL}"

# LND connection details
LN_SERVER_URL: "https://$APP_LIGHTNING_NODE_IP:$APP_LIGHTNING_NODE_REST_PORT"
Expand Down
17 changes: 17 additions & 0 deletions ride-the-lightning/exports.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Dynamically export the block explorer URL based on what network the Bitcoin node is running on

BLOCK_EXPLORER_URL="https://mempool.space"

# TODO: check for umbrelOS Mempool app and use local URL if installed
# e.g., "${UMBREL_ROOT}/scripts/app" ls-installed | grep --quiet 'mempool'
# RTL would need a way to dynamically construct the URL for the local Mempool app
# e.g., localExplorerUrl = `${window.location.protocol}//${window.location.hostname}:${LOCAL_MEMPOOL_PORT}`;

# Append APP_BITCOIN_NETWORK to the URL if it is not mainnet (e.g., https://mempool.space/testnet)
if [[ "${APP_BITCOIN_NETWORK}" != "mainnet" ]]; then
echo "Bitcoin is running on ${APP_BITCOIN_NETWORK}. Appending ${APP_BITCOIN_NETWORK} to the block explorer URL."
BLOCK_EXPLORER_URL="${BLOCK_EXPLORER_URL}/${APP_BITCOIN_NETWORK}"
echo "BLOCK_EXPLORER_URL: ${BLOCK_EXPLORER_URL}"
fi

export APP_RTL_BLOCK_EXPLORER_URL="${BLOCK_EXPLORER_URL}"
Empty file added ride-the-lightning/rtl/.gitkeep
Empty file.

0 comments on commit 09efd3f

Please sign in to comment.