mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
0b1f8fdbf0
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`.
22 lines
668 B
Bash
Executable File
22 lines
668 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
: "${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 "${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:${networkdatadir}/lightning-rpc" &
|
|
fg %-
|
|
else
|
|
exec lightningd --network="${LIGHTNINGD_NETWORK}" "$@"
|
|
fi
|