From ddefb29e49bbe85f30c5c00bd7eb0ae425d8f171 Mon Sep 17 00:00:00 2001 From: Robert Martin-Legene <robert@nic.ar> Date: Fri, 20 Sep 2019 19:39:03 -0300 Subject: [PATCH] Example startup script for the API --- api/start.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 api/start.sh diff --git a/api/start.sh b/api/start.sh new file mode 100755 index 0000000..7aedb6b --- /dev/null +++ b/api/start.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Example startup script + +if ip a | grep -q inet.200.108.146.180/ +then + mode=test2 +else + mode=${1:-prod} +fi + +cd `dirname $0` +case "$mode" in + "prod") + modedir=$( echo ~bfa/bfa/network ) + export CONTRACT_ADDRESS="0x7e56220069CAaF8367EA42817EA9210296AeC7c6" + ;; + "test2") + modedir=$( echo ~bfa/bfa/test2network ) + export CONTRACT_ADDRESS="0xFc0f01A88bD08b988173A2354952087C9492d947" + ;; + "*") + echo "Unsupported mode." >&2 + echo "Usage: $0 <test2|prod>" >&2 + exit 1 + ;; +esac +export GETH_ACCOUNT_JSON=$( ls -1 ${modedir}/node/keystore/UTC* | head -1 ) +export GETH_ACCOUNT_PASSWORD="" +export GETH_HOST=http://localhost:8545 +export CONTRACT_ABI_PATH="${PWD}/abi.json" + +# roll logs +higher=10 +for n in {9..0} +do + if [ $n -eq 0 ] + then + mv -f "nohup.out" "nohup.out.$higher" + else + mv -f "nohup.out.$n" "nohup.out.$higher" + fi + higher=$n +done + +nohup npm run serve & +sleep 1 -- GitLab