mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-19 01:40:16 +01:00
#3135 fix config on startup
This commit is contained in:
parent
337e391054
commit
08b00706ab
@ -180,9 +180,6 @@ elif [ "$1" = "set" ]; then
|
|||||||
sudo sed -i "s/^${keystr}=.*/${keystr}='${valuestr}'/g" ${infoFile}
|
sudo sed -i "s/^${keystr}=.*/${keystr}='${valuestr}'/g" ${infoFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# also publish new set values on a redis channel called `system`
|
|
||||||
|
|
||||||
# get
|
# get
|
||||||
elif [ "$1" = "get" ]; then
|
elif [ "$1" = "get" ]; then
|
||||||
|
|
||||||
|
@ -131,9 +131,6 @@ if [ "$1" = "update-config" ]; then
|
|||||||
chain="main"
|
chain="main"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get actual state of system
|
|
||||||
source <(/home/admin/_cache.sh get setupPhase)
|
|
||||||
|
|
||||||
# prepare config update
|
# prepare config update
|
||||||
cd /root/blitz_api
|
cd /root/blitz_api
|
||||||
cp ./.env_sample ./.env
|
cp ./.env_sample ./.env
|
||||||
@ -142,11 +139,12 @@ if [ "$1" = "update-config" ]; then
|
|||||||
sed -i "s/^# platform=.*/platform=raspiblitz/g" ./.env
|
sed -i "s/^# platform=.*/platform=raspiblitz/g" ./.env
|
||||||
sed -i "s/^platform=.*/platform=raspiblitz/g" ./.env
|
sed -i "s/^platform=.*/platform=raspiblitz/g" ./.env
|
||||||
|
|
||||||
if [ "${setupPhase}" == "done" ]; then
|
source <(/home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
if [ "${isMounted}" == "1" ]; then
|
||||||
|
|
||||||
# configure bitcoin
|
# configure bitcoin
|
||||||
RPCUSER=$(sudo cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep rpcuser | cut -c 9-)
|
RPCUSER=$(cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep rpcuser | cut -c 9-)
|
||||||
RPCPASS=$(sudo cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep rpcpassword | cut -c 13-)
|
RPCPASS=$(cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep rpcpassword | cut -c 13-)
|
||||||
if [ "${RPCUSER}" == "" ]; then
|
if [ "${RPCUSER}" == "" ]; then
|
||||||
RPCUSER="raspibolt"
|
RPCUSER="raspibolt"
|
||||||
fi
|
fi
|
||||||
@ -164,8 +162,8 @@ if [ "$1" = "update-config" ]; then
|
|||||||
if [ "${lightning}" == "lnd" ]; then
|
if [ "${lightning}" == "lnd" ]; then
|
||||||
|
|
||||||
echo "# CONFIG Web API Lightning --> LND"
|
echo "# CONFIG Web API Lightning --> LND"
|
||||||
tlsCert=$(sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/tls.cert)
|
tlsCert=$(xxd -ps -u -c 1000 /mnt/hdd/lnd/tls.cert)
|
||||||
adminMacaroon=$(sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/bitcoin/${chain}net/admin.macaroon)
|
adminMacaroon=$(xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/bitcoin/${chain}net/admin.macaroon)
|
||||||
sed -i "s/^ln_node=.*/ln_node=lnd_grpc/g" ./.env
|
sed -i "s/^ln_node=.*/ln_node=lnd_grpc/g" ./.env
|
||||||
sed -i "s/^lnd_grpc_ip=.*/lnd_grpc_ip=127.0.0.1/g" ./.env
|
sed -i "s/^lnd_grpc_ip=.*/lnd_grpc_ip=127.0.0.1/g" ./.env
|
||||||
sed -i "s/^lnd_macaroon=.*/lnd_macaroon=${adminMacaroon}/g" ./.env
|
sed -i "s/^lnd_macaroon=.*/lnd_macaroon=${adminMacaroon}/g" ./.env
|
||||||
@ -225,10 +223,10 @@ fi
|
|||||||
###################
|
###################
|
||||||
if [ "$1" = "update-code" ]; then
|
if [ "$1" = "update-code" ]; then
|
||||||
|
|
||||||
apiActive=$(sudo ls /etc/systemd/system/blitzapi.service | grep -c blitzapi.service)
|
apiActive=$(ls /etc/systemd/system/blitzapi.service | grep -c blitzapi.service)
|
||||||
if [ "${apiActive}" != "0" ]; then
|
if [ "${apiActive}" != "0" ]; then
|
||||||
echo "# Update Web API CODE"
|
echo "# Update Web API CODE"
|
||||||
sudo systemctl stop blitzapi
|
systemctl stop blitzapi
|
||||||
cd /root/blitz_api
|
cd /root/blitz_api
|
||||||
currentBranch=$(git rev-parse --abbrev-ref HEAD)
|
currentBranch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
echo "# updating local repo ..."
|
echo "# updating local repo ..."
|
||||||
@ -241,7 +239,7 @@ if [ "$1" = "update-code" ]; then
|
|||||||
else
|
else
|
||||||
echo "# no code changes"
|
echo "# no code changes"
|
||||||
fi
|
fi
|
||||||
sudo systemctl start blitzapi
|
systemctl start blitzapi
|
||||||
echo "# BRANCH ---> ${currentBranch}"
|
echo "# BRANCH ---> ${currentBranch}"
|
||||||
echo "# old commit -> ${oldCommit}"
|
echo "# old commit -> ${oldCommit}"
|
||||||
echo "# new commit -> ${newCommit}"
|
echo "# new commit -> ${newCommit}"
|
||||||
|
Loading…
Reference in New Issue
Block a user