mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
Take LIGHTNINGD_NETWORK env variable in Dockerfile.
Before this, docker image will never detects that `lightning-rpc` was created if it is running in regtest or testnet, because the file will be created under subfolder for each network name, and entrypoint does not check "lightning-rpc" file in those folders. By specifying `LIGHTNINGD_NETWORK` environment var in dockerfile, we can now check correct path. Changelog-Added: Docker build now includes `LIGHTNINGD_NETWORK` ENV variable which defaults to "bitcoin". An user can override this (e.g. by `-e` option in `docker run`) to run docker container in regtest or testnet or any valid argument to `--network`.
This commit is contained in:
parent
3fec96a7b1
commit
0b1f8fdbf0
@ -88,6 +88,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends socat inotify-t
|
||||
ENV LIGHTNINGD_DATA=/root/.lightning
|
||||
ENV LIGHTNINGD_RPC_PORT=9835
|
||||
ENV LIGHTNINGD_PORT=9735
|
||||
ENV LIGHTNINGD_NETWORK=bitcoin
|
||||
|
||||
RUN mkdir $LIGHTNINGD_DATA && \
|
||||
touch $LIGHTNINGD_DATA/config
|
||||
|
@ -2,18 +2,20 @@
|
||||
|
||||
: "${EXPOSE_TCP:=false}"
|
||||
|
||||
networkdatadir="${LIGHTNINGD_DATA}/${LIGHTNINGD_NETWORK}"
|
||||
|
||||
if [ "$EXPOSE_TCP" == "true" ]; then
|
||||
set -m
|
||||
lightningd "$@" &
|
||||
|
||||
echo "C-Lightning starting"
|
||||
while read -r i; do if [ "$i" = "lightning-rpc" ]; then break; fi; done \
|
||||
< <(inotifywait -e create,open --format '%f' --quiet "$LIGHTNINGD_DATA" --monitor)
|
||||
< <(inotifywait -e create,open --format '%f' --quiet "${networkdatadir}" --monitor)
|
||||
echo "C-Lightning started"
|
||||
echo "C-Lightning started, RPC available on port $LIGHTNINGD_RPC_PORT"
|
||||
|
||||
socat "TCP4-listen:$LIGHTNINGD_RPC_PORT,fork,reuseaddr" "UNIX-CONNECT:$LIGHTNINGD_DATA/lightning-rpc" &
|
||||
socat "TCP4-listen:$LIGHTNINGD_RPC_PORT,fork,reuseaddr" "UNIX-CONNECT:${networkdatadir}/lightning-rpc" &
|
||||
fg %-
|
||||
else
|
||||
exec lightningd "$@"
|
||||
exec lightningd --network="${LIGHTNINGD_NETWORK}" "$@"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user