Skip to content

Commit 2fdb46c

Browse files
authored
Preserve telemetry name if already set. (#19)
If telemetry is disabled direct user to enable (if so desired) by running applicable binary command.
1 parent 2035e79 commit 2fdb46c

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

bin/set-telemetry-name

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ set_telemetry_name() {
2929

3030
set_telemetry_name
3131

32-
bash -c "env VOINETWORK_TELEMETRY_NAME=$VOINETWORK_TELEMETRY_NAME docker stack deploy -c ../docker-swarm/compose.yml voinetwork"
32+
bash -c "env VOINETWORK_TELEMETRY_NAME=$VOINETWORK_TELEMETRY_NAME docker stack deploy -c ${HOME}/voi/docker-swarm/compose.yml voinetwork"
3333

3434
echo "Changes has been applied to the network. Please wait a minute for the changes to take effect."

install.sh

+16-1
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,21 @@ add_docker_groups() {
449449
fi
450450
}
451451

452+
get_telemetry_name() {
453+
if [[ -f "/var/lib/voi/algod/data/logging.config" ]]; then
454+
VOINETWORK_TELEMETRY_NAME=$(execute_sudo "cat /var/lib/voi/algod/data/logging.config" | jq -r '.Name')
455+
fi
456+
}
457+
452458
set_telemetry_name() {
453459
if [[ ${headless_install} -eq 1 ]]; then
454460
## Allow headless install to skip telemetry name setup in case people bring their own wallets / use CI
455461
return
456462
fi
457-
if [[ -z ${VOINETWORK_TELEMETRY_NAME} ]]; then
463+
464+
display_banner "Telemetry"
465+
466+
if [[ -z ${VOINETWORK_TELEMETRY_NAME} && ! -f "/var/lib/voi/algod/data/logging.config" ]]; then
458467
echo "Voi uses telemetry to make the network better and reward users with Voi if participating."
459468
echo ""
460469
echo "Type your telemetry name below. We'll add 'VOI:' at the start to show you're using this package."
@@ -471,6 +480,10 @@ set_telemetry_name() {
471480
else
472481
VOINETWORK_TELEMETRY_NAME="VOI:$VOINETWORK_TELEMETRY_NAME"
473482
fi
483+
elif [[ -n ${VOINETWORK_TELEMETRY_NAME} ]]; then
484+
echo "Your telemetry name is already set to '${VOINETWORK_TELEMETRY_NAME}'"
485+
else
486+
echo "Telemetry is disabled. To enable telemetry, execute the command ${HOME}/voi/bin/set-telemetry-name"
474487
fi
475488
}
476489

@@ -499,6 +512,8 @@ if [[ -n ${VOINETWORK_SKIP_WALLET_SETUP} && ${VOINETWORK_SKIP_WALLET_SETUP} -eq
499512
headless_install=1
500513
fi
501514

515+
get_telemetry_name
516+
502517
set_telemetry_name
503518

504519
display_banner "Installing Docker"

0 commit comments

Comments
 (0)