From ebc4e85d07be9e24b583909097352783d90e0fb0 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Wed, 12 Apr 2023 13:37:30 +0530 Subject: [PATCH] Configure relay node's announce domain from env --- app/data/compose/docker-compose-watcher-mobymask-v2.yml | 1 + app/data/config/watcher-mobymask-v2/mobymask-params.env | 3 +++ app/data/config/watcher-mobymask-v2/start-server.sh | 4 +++- .../config/watcher-mobymask-v2/watcher-config-template.toml | 1 + app/data/stacks/mobymask-v2/mobymask-only.md | 3 +++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/data/compose/docker-compose-watcher-mobymask-v2.yml b/app/data/compose/docker-compose-watcher-mobymask-v2.yml index 3af4eccb..337e6610 100644 --- a/app/data/compose/docker-compose-watcher-mobymask-v2.yml +++ b/app/data/compose/docker-compose-watcher-mobymask-v2.yml @@ -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_ANNOUNCE_DOMAIN: ${CERC_RELAY_ANNOUNCE_DOMAIN} CERC_ENABLE_PEER_L2_TXS: ${CERC_ENABLE_PEER_L2_TXS} CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} command: ["sh", "start-server.sh"] diff --git a/app/data/config/watcher-mobymask-v2/mobymask-params.env b/app/data/config/watcher-mobymask-v2/mobymask-params.env index 9f967170..e4c9f02b 100644 --- a/app/data/config/watcher-mobymask-v2/mobymask-params.env +++ b/app/data/config/watcher-mobymask-v2/mobymask-params.env @@ -5,6 +5,9 @@ DEFAULT_CERC_WATCHER_HOST="mobymask-watcher-server" DEFAULT_CERC_WATCHER_PORT=3001 DEFAULT_CERC_APP_WATCHER_URL="http://localhost:3001" +# Domain to be used in the relay node's announce address +DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN= + # Base URI for mobymask-app (used for generating invite) DEFAULT_CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#" diff --git a/app/data/config/watcher-mobymask-v2/start-server.sh b/app/data/config/watcher-mobymask-v2/start-server.sh index ee7b73c3..3808e2a3 100755 --- a/app/data/config/watcher-mobymask-v2/start-server.sh +++ b/app/data/config/watcher-mobymask-v2/start-server.sh @@ -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_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}}" @@ -32,7 +33,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_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \ + sed -E "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; \ s|REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT|${CERC_L2_GETH_RPC}| ") diff --git a/app/data/config/watcher-mobymask-v2/watcher-config-template.toml b/app/data/config/watcher-mobymask-v2/watcher-config-template.toml index 843cdbfe..0ac84ef9 100644 --- a/app/data/config/watcher-mobymask-v2/watcher-config-template.toml +++ b/app/data/config/watcher-mobymask-v2/watcher-config-template.toml @@ -28,6 +28,7 @@ port = 9090 relayPeers = [] peerIdFile = './relay-id.json' + announce = 'REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN' enableDebugInfo = true [server.p2p.peer] diff --git a/app/data/stacks/mobymask-v2/mobymask-only.md b/app/data/stacks/mobymask-v2/mobymask-only.md index 27073034..2ec7ac06 100644 --- a/app/data/stacks/mobymask-v2/mobymask-only.md +++ b/app/data/stacks/mobymask-v2/mobymask-only.md @@ -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/#" + # Domain to be used in the relay node's announce address + CERC_RELAY_ANNOUNCE_DOMAIN= + # Set to false for disabling watcher peer to send txs to L2 CERC_ENABLE_PEER_L2_TXS=true