stack-orchestrator/app/data/config/watcher-mobymask-v2/server-start.sh
Nabarun Gogoi 94e38ceaba
Add ability to run mobymask-v2 stack with external optimism endpoint (#279)
* Set optimism geth endpoint from env file

* Set L1 account private keys from env

* Only deploy contract and generate invite in mobymask container

* Add readme for running mobymask v2 stack independently

* Modify mobymask container to stop running server and update readmes

* Check deployer account balance before deploying contract

* Fix for checking account balance before deploying

* Update readme description

* Update MobyMask repo tag in readme
2023-04-05 17:26:38 +05:30

26 lines
862 B
Bash
Executable File

#!/bin/sh
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
# Assign deployed contract address from server config
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
if [ -f /geth-accounts/accounts.csv ]; then
echo "Using L1 private key from the mounted volume"
# Read the private key of L1 account for sending txs from peer
PRIVATE_KEY_PEER=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
else
echo "Using PRIVATE_KEY_PEER from env"
fi
sed "s/REPLACE_WITH_PRIVATE_KEY/${PRIVATE_KEY_PEER}/" environments/watcher-config-template.toml > environments/local.toml
sed -i "s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/" environments/local.toml
export L2_GETH_URL="http://${L2_GETH_HOST}:${L2_GETH_PORT}"
sed -i 's|REPLACE_WITH_L2_GETH_URL|'"${L2_GETH_URL}"'|' environments/local.toml
echo 'yarn server'
yarn server