-
Notifications
You must be signed in to change notification settings - Fork 12
/
entrypoint
executable file
·42 lines (28 loc) · 1.49 KB
/
entrypoint
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
#!/bin/bash
rippledcnflc=`/bin/cat /keystore/rippled.cfg 2>/dev/null | wc -l`
ripplevalidatorkslc=`/bin/cat /keystore/validator-keys.json 2>/dev/null | wc -l`
validatorslc=`/bin/cat /keystore/validators.txt 2>/dev/null | wc -l`
mkdir -p /root/.ripple
mkdir -p /keystore
if [[ "$rippledcnflc" -gt "0" && "$ripplevalidatorkslc" -gt "0" && "$validatorslc" -gt "0" ]]; then
echo "Existing rippled config at host /keystore/, using them."
/bin/cat /keystore/rippled.cfg > /etc/opt/ripple/rippled.cfg
/bin/cat /keystore/validators.txt > /etc/opt/ripple/validators.txt
/bin/cat /keystore/validator-keys.json > /root/.ripple/validator-keys.json
fi
if [[ "$ripplevalidatorkslc" -lt "1" ]]; then
echo "No host-validator-keys, generating validator keys"
/opt/ripple/bin/validator-keys create_keys
/bin/cat /root/.ripple/validator-keys.json > /keystore/validator-keys.json 2>/dev/null
token=$(/opt/ripple/bin/validator-keys create_token --keyfile /root/.ripple/validator-keys.json)
token=${token#*]}
cp /etc/opt/ripple/rippled.cfg /rippled.cfg
echo "[validator_token]" >> /rippled.cfg
echo $token | tr " " "\n" >> /rippled.cfg
cp /rippled.cfg /etc/opt/ripple/rippled.cfg
rm /rippled.cfg
/bin/cat /etc/opt/ripple/rippled.cfg > /keystore/rippled.cfg 2>/dev/null
/bin/cat /etc/opt/ripple/validators.txt > /keystore/validators.txt 2>/dev/null
fi
# Start rippled, Passthrough other arguments
exec /opt/ripple/bin/rippled --net --conf /etc/opt/ripple/rippled.cfg "$@"