Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set chain id properly in blockchain node param config scripts #1157

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion config_client_api_ip_whitelist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,13 @@ printf "Enter password: "
read -s PASSWORD
printf "\n\n"
if [[ $SEASON = "mainnet" ]]; then
CHAIN_ID="1"
KEYSTORE_DIR="mainnet_prod_keys"
elif [[ $SEASON = "spring" ]] || [[ $SEASON = "summer" ]]; then
CHAIN_ID="0"
KEYSTORE_DIR="testnet_prod_keys"
else
CHAIN_ID="0"
KEYSTORE_DIR="testnet_dev_staging_keys"
fi

Expand All @@ -87,14 +90,18 @@ else
COMMAND_NODE_JS_FILE="getDevClientApiIpWhitelist.js"
fi

printf "CHAIN_ID=$CHAIN_ID\n"
printf "KEYSTORE_DIR=$KEYSTORE_DIR\n"
printf "COMMAND_NODE_JS_FILE=$COMMAND_NODE_JS_FILE\n"

function config_node() {
local node_index="$1"
local node_ip_addr=${IP_ADDR_LIST[${node_index}]}

printf "\n\n<<< Configuring ip whitelist of node $node_index ($node_ip_addr) >>>\n\n"

KEYSTORE_FILE_PATH="$KEYSTORE_DIR/keystore_node_$node_index.json"
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_ip_addr 0 keystore $KEYSTORE_FILE_PATH"
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_ip_addr $CHAIN_ID keystore $KEYSTORE_FILE_PATH"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

if [[ ! $COMMAND = "get" ]]; then
CONFIG_NODE_CMD="$CONFIG_NODE_CMD '$IP_ADDR'"
fi
Expand Down
10 changes: 9 additions & 1 deletion config_node_param.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function usage() {
printf "Example: bash config_node_param.sh dev add DEV_CLIENT_API_IP_WHITELIST '*'\n"
printf "Example: bash config_node_param.sh dev remove DEV_CLIENT_API_IP_WHITELIST 32.190.239.181\n"
printf "Example: bash config_node_param.sh dev set DEV_CLIENT_API_IP_WHITELIST '*'\n"
printf "Example: bash config_node_param.sh dev get CORS_WHITELIST\n"
printf "\n"
exit
}
Expand Down Expand Up @@ -80,10 +81,13 @@ printf "Enter password: "
read -s PASSWORD
printf "\n\n"
if [[ $SEASON = "mainnet" ]]; then
CHAIN_ID="1"
KEYSTORE_DIR="mainnet_prod_keys"
elif [[ $SEASON = "spring" ]] || [[ $SEASON = "summer" ]]; then
CHAIN_ID="0"
KEYSTORE_DIR="testnet_prod_keys"
else
CHAIN_ID="0"
KEYSTORE_DIR="testnet_dev_staging_keys"
fi

Expand All @@ -97,14 +101,18 @@ else
COMMAND_NODE_JS_FILE="getNodeParam.js"
fi

printf "CHAIN_ID=$CHAIN_ID\n"
printf "KEYSTORE_DIR=$KEYSTORE_DIR\n"
printf "COMMAND_NODE_JS_FILE=$COMMAND_NODE_JS_FILE\n"

function config_node() {
local node_index="$1"
local node_ip_addr=${IP_ADDR_LIST[${node_index}]}

printf "\n\n<<< Configuring ip whitelist of node $node_index ($node_ip_addr) >>>\n\n"

KEYSTORE_FILE_PATH="$KEYSTORE_DIR/keystore_node_$node_index.json"
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_ip_addr 0 keystore $KEYSTORE_FILE_PATH $PARAM"
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_ip_addr $CHAIN_ID keystore $KEYSTORE_FILE_PATH $PARAM"
if [[ ! $COMMAND = "get" ]]; then
CONFIG_NODE_CMD="$CONFIG_NODE_CMD '$VALUE'"
fi
Expand Down