set custom port

set custom ports

portset.sh

#!/bin/bash

DIR="$1"
MINIGAS=${2:-0uinit}
PORT=${3:-2}

if [ -z "$DIR" ]; then
  echo "no base dir"
  exit 1
fi

if [ -z "$MINIGAS" ]; then
  echo "no minimum-gas-prices"
  exit 1
fi


# Set minimum gas price
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"${MINIGAS}\"|" ${DIR}/config/app.toml

# Set pruning
sed -i \
  -e 's|^pruning *=.*|pruning = "custom"|' \
  -e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \
  -e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
  -e 's|^pruning-interval *=.*|pruning-interval = "10"|' \
  ${DIR}/config/app.toml

# Set State sync snapshots 
sed -i \
  -e 's|^snapshot-interval *=.*|snapshot-interval = 0|' \
  -e 's|^snapshot-keep-recent *=.*|snapshot-keep-recent = 2|' \
  ${DIR}/config/app.toml

# Set monitor
sed -i \
  -e 's|^prometheus *=.*|prometheus = true|' \
  ${DIR}/config/config.toml

# Set tx_index
sed -i \
  -e 's|^indexer *=.*|indexer = "null"|' \
  ${DIR}/config/config.toml

# Set storage
sed -i \
  -e 's|^discard_abci_responses *=.*|discard_abci_responses = true|' \
  ${DIR}/config/config.toml


# Set port
sed -i -e "s%^proxy_app = \"tcp://.*:26658\"%proxy_app = \"tcp://127.0.0.1:${PORT}6658\"%; s%^laddr = \"tcp://.*:26657\"%laddr = \"tcp://0.0.0.0:${PORT}6657\"%; s%^pprof_laddr = \".*:6060\"%pprof_laddr = \"127.0.0.1:${PORT}6060\"%; s%^laddr = \"tcp://.*:26656\"%laddr = \"tcp://0.0.0.0:${PORT}6656\"%; s%^prometheus_listen_addr = \".*:26660\"%prometheus_listen_addr = \":${PORT}6660\"%" ${DIR}/config/config.toml
sed -i -e "s%^metrics-address = \".*:6065\"%metrics-address = \"127.0.0.1:${PORT}6065\"%; s%^ws-address = \".*:8546\"%ws-address = \"tcp://127.0.0.1:${PORT}8546\"%; s%^address = \".*:8545\"%address = \"127.0.0.1:${PORT}8545\"%; s%^address = \"tcp://.*:1317\"%address = \"tcp://127.0.0.1:${PORT}1317\"%; s%^address = \".*:8080\"%address = \"127.0.0.1:${PORT}8080\"%; s%^address = \".*:9090\"%address = \"127.0.0.1:${PORT}9090\"%; s%^address = \".*:9091\"%address = \"127.0.0.1:${PORT}9091\"%" ${DIR}/config/app.toml

Last updated