forked from clams-tech/clams-app-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathreload_dev_plugins.sh
executable file
·55 lines (41 loc) · 1.73 KB
/
reload_dev_plugins.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -eu
cd "$(dirname "$0")"
. ./defaults.env
. ./load_env.sh
DEV_PLUGIN_PATH="$(pwd)/lnplay/clightning/cln-plugins"
function reload_plugin {
if [ "$1" = true ]; then
for ((CLN_ID=0; CLN_ID<"$CLN_COUNT"; CLN_ID++)); do
SCRIPTS="$2"
# iterate over py scripts.
for PLUGIN_FILENAME in $SCRIPTS; do
chmod +x "$DEV_PLUGIN_PATH/$3/$PLUGIN_FILENAME"
FILE_NAME=$(basename "$DEV_PLUGIN_PATH/$3/$PLUGIN_FILENAME")
PLUGIN_LOADED=false
PLUGIN_LIST_OUTPUT=$(./lightning-cli.sh --id="$CLN_ID" plugin list)
if echo "$PLUGIN_LIST_OUTPUT" | grep -q "$FILE_NAME"; then
PLUGIN_LOADED=true
fi
if [ "$PLUGIN_LOADED" = true ]; then
./lightning-cli.sh --id="$CLN_ID" plugin stop "/cln-plugins/$3/$FILE_NAME" > /dev/null
fi
./lightning-cli.sh --id="$CLN_ID" plugin start "/cln-plugins/$3/$FILE_NAME" > /dev/null
echo "INFO: Plugin '$FILE_NAME' is available on 'cln-$CLN_ID'."
done
done
fi
}
if [ "$DEPLOY_RECKLESS_WRAPPER_PLUGIN" = true ]; then
reload_plugin "$DEPLOY_RECKLESS_WRAPPER_PLUGIN" "reckless-wrapper.py" "cln-reckless-wrapper"
fi
if [ "$DEPLOY_PRISM_PLUGIN" = true ]; then
reload_plugin "$DEPLOY_PRISM_PLUGIN" "bolt12-prism.py" "bolt12-prism"
#reload_plugin "$DEPLOY_PRISM_PLUGIN" "prism-payer.py" "bolt12-prism"
fi
if [ "$DEPLOY_LNPLAYLIVE_PLUGIN" = true ]; then
reload_plugin "$DEPLOY_LNPLAYLIVE_PLUGIN" "lnplay-live-api.py" "lnplaylive"
fi
if [ "$DEPLOY_LNPLAYLIVE_PLUGIN" = true ]; then
reload_plugin "$DEPLOY_LNPLAYLIVE_PLUGIN" "invoice_paid.py" "lnplaylive"
fi