Fix web-app start script to use env variables in config

This commit is contained in:
2023-04-18 10:55:26 +05:30
parent e43afe21fe
commit 85eeb2e99f
8 changed files with 55 additions and 28 deletions
@@ -1,9 +0,0 @@
# Config for mobymask-app running with mobymask-v2-watcher
address:
chainId:
relayNodes:
watcherUrl:
@@ -28,14 +28,10 @@ else
echo "Taking deployed contract details from env"
fi
# Use yq to replace the values in the YAML file with environment variables
yq e \
--arg deployed_contract "$CERC_DEPLOYED_CONTRACT" \
--arg watcher_url "$CERC_APP_WATCHER_URL" \
--arg chain_id "$CERC_CHAIN_ID" \
--argjson relay_nodes "$CERC_RELAY_NODES" \
'.address = $deployed_contract | .chainId = $chain_id | .relayNodes = $relay_nodes | .watcherUrl = $watcher_url' \
/config/config-template.yml \
| envsubst > /config/config.yml
# Use yq to create config.yml with environment variables
yq -n ".address = env(CERC_DEPLOYED_CONTRACT)" > /config/config.yml
yq ".watcherUrl = env(CERC_APP_WATCHER_URL)" -i /config/config.yml
yq ".chainId = env(CERC_CHAIN_ID)" -i /config/config.yml
yq ".relayNodes = env(CERC_RELAY_NODES)" -i /config/config.yml
sh /scripts/mobymask-app-start.sh
sh /scripts/start-serving-app.sh