Browse Source

Handle environment variables allowing to set custom IP and ports for tor and nginx containers

use-env-var-docker
Lounès Ksouri 4 years ago
parent
commit
66006911b3
No known key found for this signature in database GPG Key ID: F8DC83D24F68572D
  1. 5
      docker/my-dojo/bitcoin/restart.sh
  2. 10
      docker/my-dojo/node/keys.index.js
  3. 4
      docker/my-dojo/whirlpool/restart.sh

5
docker/my-dojo/bitcoin/restart.sh

@ -3,6 +3,9 @@ set -e
echo "## Start bitcoind #############################"
TOR_PROXY_IP=${TOR_PROXY_IP:-172.28.1.4}
TOR_PROXY_PORT=${TOR_PROXY_PORT:-9050}
bitcoind_options=(
-datadir=/home/bitcoin/.bitcoin
-printtoconsole=1
@ -15,7 +18,7 @@ bitcoind_options=(
-mempoolexpiry=$BITCOIND_MEMPOOL_EXPIRY
-minrelaytxfee=$BITCOIND_MIN_RELAY_TX_FEE
-port=8333
-proxy=172.28.1.4:9050
-proxy=$TOR_PROXY_IP:$TOR_PROXY_PORT
-rpcallowip=0.0.0.0/0
-rpcbind=172.28.1.5
-rpcpassword=$BITCOIND_RPC_PASSWORD

10
docker/my-dojo/node/keys.index.js

@ -22,6 +22,14 @@ if (process.env.EXPLORER_INSTALL == 'on') {
} catch(e) {}
}
// Retrieve Tor proxy from environment variables or set to defaults
let torIP = (process.env.TOR_PROXY_IP)
? process.env.TOR_PROXY_IP
: '172.28.1.4'
let torPort = (process.env.TOR_PROXY_PORT)
? process.env.TOR_PROXY_PORT
: '9050'
/**
* Desired structure of /keys/index.js, which is ignored in the repository.
@ -190,7 +198,7 @@ module.exports = {
},
// Use a SOCKS5 proxy for all communications with external services
// Values: null if no socks5 proxy used, otherwise the url of the socks5 proxy
socks5Proxy: 'socks5h://172.28.1.4:9050',
socks5Proxy: `socks5h://${torIP}:${torPort}`,
// OXT (mainnet)
oxt: process.env.NODE_URL_OXT_API,
// Esplora (testnet)

4
docker/my-dojo/whirlpool/restart.sh

@ -17,10 +17,10 @@ whirlpool_options=(
if [ "$COMMON_BTC_NETWORK" == "testnet" ]; then
whirlpool_options+=(--cli.server="TESTNET")
whirlpool_options+=(--cli.dojo.url="http://172.30.1.3:80/test/v2/")
whirlpool_options+=(--cli.dojo.url="http://${NGINX_IP:-172.30.1.3}:80/test/v2/")
else
whirlpool_options+=(--cli.server="MAINNET")
whirlpool_options+=(--cli.dojo.url="http://172.30.1.3:80/v2/")
whirlpool_options+=(--cli.dojo.url="http://${NGINX_IP:-172.30.1.3}:80/v2/")
fi
if [ "$WHIRLPOOL_RESYNC" == "on" ]; then

Loading…
Cancel
Save