mynode/rootfs/standard/usr/bin/mynode_gen_lnd_config.sh

35 lines
1.2 KiB
Bash
Raw Normal View History

2019-11-04 04:50:47 +00:00
#!/bin/bash
2020-05-14 01:05:04 +00:00
# Setup Initial LND Node Name
if [ ! -f /mnt/hdd/mynode/settings/.lndalias ]; then
echo "mynodebtc.com [myNode]" > /mnt/hdd/mynode/settings/.lndalias
fi
2019-11-04 04:50:47 +00:00
# Generate LND Config
2019-11-05 01:34:19 +00:00
if [ -f /mnt/hdd/mynode/settings/lnd_custom.conf ]; then
2020-01-29 01:59:46 +00:00
# Use Custom Config
2019-11-05 01:34:19 +00:00
cp -f /mnt/hdd/mynode/settings/lnd_custom.conf /mnt/hdd/mynode/lnd/lnd.conf
else
2020-01-29 01:59:46 +00:00
# Generate a default config
2019-11-05 01:34:19 +00:00
cp -f /usr/share/mynode/lnd.conf /mnt/hdd/mynode/lnd/lnd.conf
2020-01-29 01:59:46 +00:00
# Append other sections
if [ -f /mnt/hdd/mynode/settings/.btc_lnd_tor_enabled ]; then
cat /usr/share/mynode/lnd_tor.conf >> /mnt/hdd/mynode/lnd/lnd.conf
else
cat /usr/share/mynode/lnd_ipv4.conf >> /mnt/hdd/mynode/lnd/lnd.conf
fi
2019-11-05 01:34:19 +00:00
fi
2019-11-04 04:50:47 +00:00
# Append tor domain
if [ -f /var/lib/tor/mynode_lnd/hostname ]; then
echo "" >> /mnt/hdd/mynode/lnd/lnd.conf
echo "[Application Options]" >> /mnt/hdd/mynode/lnd/lnd.conf
ONION_URL=$(cat /var/lib/tor/mynode_lnd/hostname)
echo "tlsextradomain=$ONION_URL" >> /mnt/hdd/mynode/lnd/lnd.conf
echo "" >> /mnt/hdd/mynode/lnd/lnd.conf
fi
2019-11-04 04:50:47 +00:00
ALIAS=$(cat /mnt/hdd/mynode/settings/.lndalias)
sed -i "s/alias=.*/alias=$ALIAS/g" /mnt/hdd/mynode/lnd/lnd.conf
chown bitcoin:bitcoin /mnt/hdd/mynode/lnd/lnd.conf