[#238]: Remove interactive password input from setup scripts

Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
anastasia prasolova 2022-11-14 15:15:00 +03:00 committed by Anastasia Prasolova
parent 79a11641ed
commit d8e825443e
6 changed files with 34 additions and 28 deletions

View file

@ -1,20 +1,18 @@
#!/usr/bin/env bash
echo "Running bin/tick.sh"
# Source env settings
. .env
. services/ir/.ir.env
source bin/helper.sh
# NeoGo binary path.
NEOGO="${NEOGO:-docker exec -it main_chain neo-go}"
NEOGO_NONINTERACTIVE="${NEOGO_NONINTERACTIVE:-docker exec -t main_chain neo-go}"
NEOGO="${NEOGO:-docker exec main_chain neo-go}"
# Wallet files to change config value
WALLET="${WALLET:-services/chain/node-wallet.json}"
WALLET_IMG="${WALLET_IMG:-wallets/node-wallet.json}"
# Wallet password that would be entered automatically; '-' means no password
PASSWD="one"
CONFIG_IMG="${CONFIG_IMG:-/wallets/config.yml}"
# Internal variables
if [[ -z "${NEOFS_NOTARY_DISABLED}" ]]; then
@ -30,7 +28,7 @@ BLOCK_DURATION=$(grep SecondsPerBlock < "$SIDECHAIN_PROTO" | awk '{print $2}') \
NETMAP_ADDR=$(bin/resolve.sh netmap.neofs) || die "Cannot resolve netmap.neofs"
# Fetch current epoch value
EPOCH=$(${NEOGO_NONINTERACTIVE} contract testinvokefunction \
EPOCH=$(${NEOGO} contract testinvokefunction \
-r "http://morph-chain.${LOCAL_DOMAIN}:30333" "${NETMAP_ADDR}" epoch \
| grep 'value' | awk -F'"' '{ print $4 }') \
|| die "Cannot fetch epoch from netmap contract"
@ -38,12 +36,13 @@ EPOCH=$(${NEOGO_NONINTERACTIVE} contract testinvokefunction \
echo "Updating NeoFS epoch to $((EPOCH+1))"
# shellcheck disable=SC2086
./bin/passwd.exp ${PASSWD} ${NEOGO} contract invokefunction \
-w ${WALLET_IMG} \
-a ${ADDR} \
${NEOGO} contract invokefunction \
--wallet-config ${CONFIG_IMG} \
-a ${ADDR} --force \
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
${NETMAP_ADDR} \
newEpoch int:$((EPOCH+1)) -- ${ADDR}:Global
newEpoch int:$((EPOCH+1)) -- ${ADDR}:Global \
|| die "Cannot increment an epoch"
# Wait one Morph block to ensure the transaction broadcasted
# shellcheck disable=SC2086