forked from OCEAN-xyz/datum-gateway-startos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_entrypoint.sh
More file actions
executable file
·32 lines (26 loc) · 1.3 KB
/
docker_entrypoint.sh
File metadata and controls
executable file
·32 lines (26 loc) · 1.3 KB
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
#!/bin/sh
mkdir -p /root/data
blocknotify=$(yq e '.bitcoind.blocknotify' "/root/start9/config.yaml")
if [ "$blocknotify" = "null" ] || [ -z "$blocknotify" ]; then
echo "Error: The blocknotify field is null or not set in Bitcoin's configuration. Your Start9 Bitcoin package may not support adding this. Knots is required."
exit 1
else
echo "blocknotify is set to: $blocknotify"
fi
filter='.'
case $(yq eval .datum.reward_sharing /root/start9/config.yaml) in
require)
filter="${filter}"'|.datum.pooled_mining_only=true'
;;
prefer)
filter="${filter}"'|.datum.pooled_mining_only=false'
;;
never)
filter="${filter}"'|.datum.pooled_mining_only=false'
filter="${filter}"'|.datum.pool_host=""'
;;
esac
yq eval -o=json '(.stratum.username_modifiers) = (.stratum.username_modifiers | map({"key": .name, "value": (.addresses | map({((.address // "") | sub("^null$"; "")): (.split | tonumber)}) | .[] as $o ireduce ({}; . + $o))}) | from_entries)' /root/start9/config.yaml > /root/data/datum_gateway_config.json
jq ${filter} /root/data/datum_gateway_config.json > /root/data/datum_gateway_config.json.tmp && mv /root/data/datum_gateway_config.json.tmp /root/data/datum_gateway_config.json
printf "\n\n [i] Starting Datum Gateway ...\n\n"
exec datum_gateway -c /root/data/datum_gateway_config.json