refactor(docker): simplify lndconnect to use docker exec only
Remove filesystem fallback with sudo - just read certs from container. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f70c2b8878
commit
c8006638b2
1 changed files with 7 additions and 23 deletions
|
|
@ -258,16 +258,10 @@ setup_atm_app() {
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
generate_lndconnect() {
|
generate_lndconnect() {
|
||||||
local lnd_data="$REGTEST_DIR/data/lnd-3"
|
|
||||||
local local_ip=$(get_local_ip)
|
local local_ip=$(get_local_ip)
|
||||||
local rest_port=8082
|
local rest_port=8082
|
||||||
|
|
||||||
local cert_path="$lnd_data/tls.cert"
|
# Read certs directly from lnd-3 container (host files are root-owned)
|
||||||
local mac_path="$lnd_data/data/chain/bitcoin/regtest/admin.macaroon"
|
|
||||||
|
|
||||||
# Check if files exist and are readable
|
|
||||||
if [[ ! -r "$cert_path" ]]; then
|
|
||||||
# Try reading cert via docker
|
|
||||||
local cert_b64=$(docker exec lnbits-lnd-3-1 base64 -w0 /root/.lnd/tls.cert 2>/dev/null | tr '+/' '-_' | tr -d '=')
|
local cert_b64=$(docker exec lnbits-lnd-3-1 base64 -w0 /root/.lnd/tls.cert 2>/dev/null | tr '+/' '-_' | tr -d '=')
|
||||||
local mac_b64=$(docker exec lnbits-lnd-3-1 base64 -w0 /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon 2>/dev/null | tr '+/' '-_' | tr -d '=')
|
local mac_b64=$(docker exec lnbits-lnd-3-1 base64 -w0 /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon 2>/dev/null | tr '+/' '-_' | tr -d '=')
|
||||||
|
|
||||||
|
|
@ -276,16 +270,6 @@ generate_lndconnect() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
fi
|
|
||||||
|
|
||||||
local cert_b64=$(base64 -w0 "$cert_path" | tr '+/' '-_' | tr -d '=')
|
|
||||||
local mac_b64=$(sudo base64 -w0 "$mac_path" 2>/dev/null | tr '+/' '-_' | tr -d '=')
|
|
||||||
|
|
||||||
if [[ -z "$mac_b64" ]]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "lndconnect://${local_ip}:${rest_port}?cert=${cert_b64}&macaroon=${mac_b64}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue