Configure relay peers list for the relay node from env

This commit is contained in:
Prathamesh Musale 2023-04-12 14:13:01 +05:30
parent ebc4e85d07
commit a40edf4e71
5 changed files with 11 additions and 2 deletions

View File

@ -70,6 +70,7 @@ services:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_L2_GETH_RPC: ${CERC_L2_GETH_RPC}
CERC_PRIVATE_KEY_PEER: ${CERC_PRIVATE_KEY_PEER}
CERC_RELAY_PEERS: ${CERC_RELAY_PEERS}
CERC_RELAY_ANNOUNCE_DOMAIN: ${CERC_RELAY_ANNOUNCE_DOMAIN}
CERC_ENABLE_PEER_L2_TXS: ${CERC_ENABLE_PEER_L2_TXS}
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}

View File

@ -5,6 +5,9 @@ DEFAULT_CERC_WATCHER_HOST="mobymask-watcher-server"
DEFAULT_CERC_WATCHER_PORT=3001
DEFAULT_CERC_APP_WATCHER_URL="http://localhost:3001"
# Set of relay peers to connect to from the relay node
DEFAULT_CERC_RELAY_PEERS=[]
# Domain to be used in the relay node's announce address
DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN=

View File

@ -7,6 +7,7 @@ fi
CERC_L2_GETH_RPC="${CERC_L2_GETH_RPC:-${DEFAULT_CERC_L2_GETH_RPC}}"
CERC_PRIVATE_KEY_PEER="${CERC_PRIVATE_KEY_PEER:-${DEFAULT_CERC_PRIVATE_KEY_PEER}}"
CERC_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}"
CERC_RELAY_ANNOUNCE_DOMAIN="${CERC_RELAY_ANNOUNCE_DOMAIN:-${DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN}}"
CERC_ENABLE_PEER_L2_TXS="${CERC_ENABLE_PEER_L2_TXS:-${DEFAULT_CERC_ENABLE_PEER_L2_TXS}}"
CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}"
@ -33,7 +34,8 @@ fi
# Read in the config template TOML file and modify it
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
sed -E "s/REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN/${CERC_RELAY_ANNOUNCE_DOMAIN}/g; \
sed -E "s/REPLACE_WITH_CERC_RELAY_PEERS/$(echo "${CERC_RELAY_PEERS}" | sed 's/\//\\\//g')/g; \
s/REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN/${CERC_RELAY_ANNOUNCE_DOMAIN}/g; \
s/REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \
s/REPLACE_WITH_CERC_PRIVATE_KEY_PEER/${CERC_PRIVATE_KEY_PEER}/g; \
s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/g; \

View File

@ -26,7 +26,7 @@
[server.p2p.relay]
host = "0.0.0.0"
port = 9090
relayPeers = []
relayPeers = REPLACE_WITH_CERC_RELAY_PEERS
peerIdFile = './relay-id.json'
announce = 'REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN'
enableDebugInfo = true

View File

@ -57,6 +57,9 @@ Create and update an env file to be used in the next step ([defaults](../../conf
# (used for generating a root invite link after deploying the contract)
CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#"
# Set of relay peers to connect to from the relay node
CERC_RELAY_PEERS=[]
# Domain to be used in the relay node's announce address
CERC_RELAY_ANNOUNCE_DOMAIN=