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

feat: allow fullnodes, make rpc optional #10

Merged
merged 2 commits into from
Feb 20, 2019
Merged
Changes from 1 commit
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
28 changes: 19 additions & 9 deletions start-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Usage:
-d, --dry-run Flag indicating to only show the resulting command instead of executing it
-t, --telemetry Flag indicating whether or not to send data to the telemetry server
-p, --purge-userdata Purges all chain-dependend user data in auxiliary services (ctypes, contacts, messages, ...)
-r, --rpc Whether to activate rpc

Examples:

Expand All @@ -64,6 +65,7 @@ account_name=
telemetry=0
purge_userdata=0
dry_run=0
rpc=0

while [[ "$1" != "" ]]; do
case $1 in
Expand All @@ -82,6 +84,8 @@ while [[ "$1" != "" ]]; do
;;
-d | --dry-run ) dry_run=1
;;
-r | --rpc ) rpc=1
;;
-h | --help ) usage
exit
;;
Expand All @@ -97,20 +101,22 @@ arg_node_key=
arg_node_name=
arg_telemetry=
arg_account_name=

if [[ -z "$account_name" ]]; then
usage
exit 1
fi
arg_rpc=

if [[ "$account_name" = "Alice" ]]; then
arg_node_key=" --node-key ${ALICE_BOOT_NODE_KEY}"
elif [[ "$account_name" = "Bob" ]]; then
arg_node_key=" --node-key ${BOB_BOOT_NODE_KEY}"
fi
arg_account_name=" --key ${account_name}"

echo "Starting KILT node with account '${account_name}'"
if [[ ! -z "$account_name" ]]; then
arg_account_name=" --key ${account_name} --validator"
echo "Starting KILT validator node with account '${account_name}'"
else
echo "Starting KILT full node"
fi


if [[ ! -z "$bootnode" ]]; then
echo "Trying to connect to boot node '$bootnode'..."
lookup_boot_node
Expand Down Expand Up @@ -140,7 +146,11 @@ if [[ "$purge_userdata" = "1" ]]; then
curl -X DELETE http://services.kilt-prototype.tk:3000/contacts
fi

command="./target/debug/node --chain ${CHAIN_NAME} --validator --port 30333 --ws-port 9944 --ws-external --rpc-external${arg_account_name}${arg_node_key}${arg_boot_node_connect}${arg_node_name}${arg_telemetry}"
if [[ "$rpc" = "1" ]]; then
arg_rpc=" --ws-port 9944 --ws-external --rpc-external"
fi

command="./target/debug/node --chain ${CHAIN_NAME} --port 30333${arg_rpc}${arg_account_name}${arg_node_key}${arg_boot_node_connect}${arg_node_name}${arg_telemetry}"

if [[ "$dry_run" = "1" ]]; then
echo "Dry run."
Expand All @@ -149,4 +159,4 @@ if [[ "$dry_run" = "1" ]]; then
fi

echo "Running: $command"
`${command}`
`${command}`