-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
68 lines (63 loc) · 1.73 KB
/
config.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
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Substitutes IP addresses with real values in topology files, other config (gLiveView.sh)
if [ $NODE_TYPE = "relay" ]
then
if [ $NODE_CONFIG = "mainnet" ]
then
cat > $NODE_HOME/${NODE_CONFIG}-topology.json << EOF
{
"Producers": [
{
"addr": "<BLOCK PRODUCER NODE PUBLIC IP ADDRESS>",
"port": 6000,
"valency": 1
},
{
"addr": "relays-new.cardano-mainnet.iohk.io",
"port": 3001,
"valency": 2
}
]
}
EOF
else
cat > $NODE_HOME/${NODE_CONFIG}-topology.json << EOF
{
"Producers": [
{
"addr": "<BLOCK PRODUCER NODE PUBLIC IP ADDRESS>",
"port": 6000,
"valency": 1
},
{
"addr": "relays-new.cardano-testnet.iohkdev.io",
"port": 3001,
"valency": 2
}
]
}
EOF
fi
sed -i ${NODE_HOME}/${NODE_CONFIG}-topology.json -e "s/<BLOCK PRODUCER NODE PUBLIC IP ADDRESS>/${BLOCK_PRODUCER_IP:-0.0.0.0}/g"
elif [ $NODE_TYPE = "block-producer" ]
then
cat > $NODE_HOME/${NODE_CONFIG}-topology.json << EOF
{
"Producers": [
{
"addr": "<RELAYNODE PUBLIC IP ADDRESS>",
"port": 6000,
"valency": 1
}
]
}
EOF
sed -i ${NODE_HOME}/${NODE_CONFIG}-topology.json -e "s/<RELAYNODE PUBLIC IP ADDRESS>/${RELAY_IP:-0.0.0.0}/g"
else
echo "This node type does not require IP address substitution. Skipping..."
fi
# Configure gLiveView
sed -i $NODE_HOME/env \
-e "s/\#CONFIG=\"\${CNODE_HOME}\/files\/config.json\"/CONFIG=\"\${NODE_HOME}\/\${NODE_CONFIG}-config.json\"/g" \
-e "s/\#SOCKET=\"\${CNODE_HOME}\/sockets\/node0.socket\"/SOCKET=\"\${NODE_HOME}\/db\/socket\"/g" \
-e "s/\#TOPOLOGY=\"\${CNODE_HOME}\/files\/topology.json\"/TOPOLOGY=\"\${NODE_HOME}\/testnet-config.json\"/g"