stack-orchestrator/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh
Nabarun Gogoi 86f13e9c6b Separate out watcher and web-apps in mobymask-v2 stack (#287)
* Separate out watcher and web-apps in mobymask stack

* Take L2 RPC endpoint from the env file

* Changes to run watcher and mobymask web-app separately

* Support running watcher without contract deployment and L2 txs

* Remove duplicate mobymask params env

* Add code comments

* Add instructions for running web-apps separately

* Self review fixes

* Fix timeout for mobymask-app on watcher server

---------

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
Former-commit-id: 6f781ae303
2023-04-06 15:17:00 +05:30

26 lines
867 B
Bash
Executable File

#!/bin/sh
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
# Use config from mounted volume if available (when running web-app along with watcher stack)
if [ -f /server/config.json ]; then
echo "Merging config for deployed contract from mounted volume"
# Merging config files to get deployed contract address
jq -s '.[0] * .[1]' /app/src/mobymask-app-config.json /server/config.json > /app/src/config.json
else
echo "Setting deployed contract details from env"
# Set config values from environment variables
jq --arg address "$DEPLOYED_CONTRACT" \
--argjson chainId $CHAIN_ID \
--argjson relayNodes "$RELAY_NODES" \
'.address = $address | .chainId = $chainId | .relayNodes = $relayNodes' \
/app/src/mobymask-app-config.json > /app/src/config.json
fi
REACT_APP_WATCHER_URI="$APP_WATCHER_URL/graphql" npm run build
serve -s build