2021-04-16 10:57:21 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Source env settings
|
|
|
|
. .env
|
|
|
|
. services/ir/.ir.env
|
|
|
|
|
|
|
|
# NeoGo binary path.
|
|
|
|
NEOGO="${NEOGO:-docker exec -it main_chain neo-go}"
|
|
|
|
|
2021-06-01 18:18:46 +00:00
|
|
|
# Wallet files to change config value
|
2021-04-16 10:57:21 +00:00
|
|
|
WALLET="${WALLET:-services/chain/node-wallet.json}"
|
|
|
|
WALLET_IMG="${WALLET_IMG:-wallets/node-wallet.json}"
|
2021-06-01 18:18:46 +00:00
|
|
|
# Wallet password that would be entered automatically; '-' means no password
|
|
|
|
PASSWD="one"
|
2021-09-21 14:59:35 +00:00
|
|
|
NETMAP_ADDR=`bin/resolve.sh netmap.neofs`
|
2021-04-16 10:57:21 +00:00
|
|
|
|
|
|
|
# NeoFS configuration record: key is a string and value is an int
|
|
|
|
KEY=${1}
|
|
|
|
VALUE="${2}"
|
|
|
|
|
|
|
|
[ -z "$KEY" ] && echo "Empty config key" && exit 1
|
|
|
|
[ -z "$VALUE" ] && echo "Empty config value" && exit 1
|
|
|
|
|
|
|
|
# Internal variables
|
2021-07-22 17:22:58 +00:00
|
|
|
if [[ -z "${NEOFS_NOTARY_DISABLED}" ]]; then
|
|
|
|
ADDR=`cat ${WALLET} | jq -r .accounts[2].address`
|
|
|
|
else
|
|
|
|
ADDR=`cat ${WALLET} | jq -r .accounts[0].address`
|
|
|
|
fi
|
2021-04-16 10:57:21 +00:00
|
|
|
|
|
|
|
# Change config value in side chain
|
|
|
|
echo "Changing ${KEY} configration value to ${VALUE}"
|
2021-06-01 18:18:46 +00:00
|
|
|
./bin/passwd.exp ${PASSWD} ${NEOGO} contract invokefunction \
|
2021-04-16 10:57:21 +00:00
|
|
|
-w ${WALLET_IMG} \
|
|
|
|
-a ${ADDR} \
|
|
|
|
-r http://morph_chain.${LOCAL_DOMAIN}:30333 \
|
2021-09-21 14:59:35 +00:00
|
|
|
${NETMAP_ADDR} \
|
2021-04-16 10:57:21 +00:00
|
|
|
setConfig bytes:beefcafe \
|
|
|
|
string:${KEY} \
|
|
|
|
int:${VALUE} -- ${ADDR} || exit 1
|
|
|
|
|
2021-06-02 14:16:57 +00:00
|
|
|
# Update epoch to apply new configuration value
|
2021-06-29 19:01:40 +00:00
|
|
|
./bin/tick.sh
|