Skip to content

Commit aa1a0e3

Browse files
committed
Docker: run directory for post-start if present.
Also, fix the case where we didn't use --network with EXPOSE_TCP, as reported by @theborakompanioni: ``` I get Wrong network! Our Bitcoin backend is running on 'regtest', but we expect 'main'. with LIGHTNINGD_NETWORK := regtest when param --network is not provided. ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent c85bce9 commit aa1a0e3

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

tools/docker-entrypoint.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@
44

55
networkdatadir="${LIGHTNINGD_DATA}/${LIGHTNINGD_NETWORK}"
66

7-
if [ "$EXPOSE_TCP" == "true" ]; then
8-
set -m
9-
lightningd "$@" &
7+
set -m
8+
lightningd --network="${LIGHTNINGD_NETWORK}" "$@" &
109

11-
echo "Core-Lightning starting"
12-
while read -r i; do if [ "$i" = "lightning-rpc" ]; then break; fi; done \
10+
echo "Core-Lightning starting"
11+
while read -r i; do if [ "$i" = "lightning-rpc" ]; then break; fi; done \
1312
< <(inotifywait -e create,open --format '%f' --quiet "${networkdatadir}" --monitor)
14-
echo "Core-Lightning started"
13+
14+
if [ "$EXPOSE_TCP" == "true" ]; then
1515
echo "Core-Lightning started, RPC available on port $LIGHTNINGD_RPC_PORT"
1616

1717
socat "TCP4-listen:$LIGHTNINGD_RPC_PORT,fork,reuseaddr" "UNIX-CONNECT:${networkdatadir}/lightning-rpc" &
18-
fg %-
19-
else
20-
exec lightningd --network="${LIGHTNINGD_NETWORK}" "$@"
2118
fi
19+
20+
# Now run any scripts which exist in the lightning-poststart.d directory
21+
if [ -d "$LIGHTNINGD_DATA"/lightning-poststart.d ]; then
22+
for f in "$LIGHTNINGD_DATA"/lightning-poststart.d/*; do
23+
"$f"
24+
done
25+
fi
26+
27+
fg %-

0 commit comments

Comments
 (0)