Fix #3123 adding cln auto-config to blitzapi (#3124)

This commit is contained in:
/rootzoll 2022-05-17 17:40:23 +02:00 committed by GitHub
parent c0b601a95b
commit a2bbecc03f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -109,6 +109,7 @@ case $CHOICE in
echo
# setting value in the raspiblitz.conf
/home/admin/config.scripts/blitz.conf.sh set lightning "cl"
sudo systemctl restart blitzapi 2>/dev/null
echo "# OK - lightning=cl is set in /mnt/hdd/raspiblitz.conf"
echo
echo "Press ENTER to return to main menu."

View File

@ -134,6 +134,7 @@ case $CHOICE in
echo
# setting value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set lightning "lnd"
sudo systemctl restart blitzapi 2>/dev/null
echo "# OK - lightning=lnd is set in /mnt/hdd/raspiblitz.conf"
echo
echo "Press ENTER to return to main menu."

View File

@ -166,9 +166,21 @@ if [ "$1" = "update-config" ]; then
echo "# CONFIG Web API Lightning --> CL"
sed -i "s/^ln_node=.*/ln_node=cl/g" ./.env
# TODO: ADD C-Lightning config as soon as available
echo "# MISSING CL CONFIG YET"
# get hex values of pem files
hexClient=$(xxd -p -c2000 /home/bitcoin/.lightning/bitcoin/client.pem)
hexClientKey=$(xxd -p -c2000 /home/bitcoin/.lightning/bitcoin/client-key.pem)
hexCa=$(xxd -p -c2000 /home/bitcoin/.lightning/bitcoin/ca.pem)
if [ "${hexClient}" == "" ]; then
echo "# FAIL /home/bitcoin/.lightning/bitcoin/*.pem files maybe missing"
fi
# update config with hex values
sed -i "s/^cln_grpc_cert=.*/cln_grpc_cert=${hexClient}/g" ./.env
sed -i "s/^cln_grpc_key=.*/cln_grpc_key=${hexClientKey}/g" ./.env
sed -i "s/^cln_grpc_ca=.*/cln_grpc_ca=${hexCa}/g" ./.env
sed -i "s/^cln_grpc_ip=.*/cln_grpc_ip=127.0.0.1/g" ./.env
sed -i "s/^cln_grpc_port=.*/cln_grpc_port=9537/g" ./.env
else
echo "# CONFIG Web API Lightning --> OFF"