From d8317106210ea2a129869fd1156469af0fb06ead Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 19 Dec 2023 02:04:51 +0100 Subject: [PATCH] Rename node_id to secret_node_id such as it gets redacted when sharing logs.. --- scripts/config | 5 ++++- scripts/install | 6 +++--- scripts/remove | 2 +- scripts/restore | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/config b/scripts/config index 0e8b3bf..d007180 100644 --- a/scripts/config +++ b/scripts/config @@ -7,6 +7,9 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= +data_dir=$(ynh_app_setting_get $app data_dir) +secret_node_id=$(ynh_app_setting_get $app data_dir) + if system_is_inside_container then nbd_index=$(cat $data_dir/nbd_index) @@ -36,7 +39,7 @@ set__weight() { systemctl start $app sleep 3 fi - $command layout assign $node_id -c $weight 2>/dev/null + $command layout assign $secret_node_id -c $weight 2>/dev/null apply_layout "$command" ynh_app_setting_set --app=$app --key=weight --value=$weight } diff --git a/scripts/install b/scripts/install index 74da92b..4465505 100755 --- a/scripts/install +++ b/scripts/install @@ -135,12 +135,12 @@ while [ -z "$($garage_command node id -q 2>/dev/null | cut -d '@' -f1)" ]; do sleep 1 done -node_id=$($garage_command node id -q 2>/dev/null | cut -d '@' -f1) -ynh_app_setting_set --app=$app --key=node_id --value=$node_id +secret_node_id=$($garage_command node id -q 2>/dev/null | cut -d '@' -f1) +ynh_app_setting_set --app=$app --key=secret_node_id --value=$secret_node_id # define node -$garage_command layout assign $node_id -z $domain -c $weight -t $domain +$garage_command layout assign $secret_node_id -z $domain -c $weight -t $domain # if there is enough node, apply layout apply_layout "$garage_command" diff --git a/scripts/remove b/scripts/remove index d138caf..e6c5473 100755 --- a/scripts/remove +++ b/scripts/remove @@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers # REMOVE NODE CONFIGURATION #================================================= -$install_dir/garage -c $install_dir/garage.toml layout remove "$node_id" +$install_dir/garage -c $install_dir/garage.toml layout remove "$secret_node_id" apply_layout "$install_dir/garage -c $install_dir/garage.toml " if [ $? -ne 0 ] diff --git a/scripts/restore b/scripts/restore index cef70ba..ddbebe5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -70,7 +70,7 @@ sleep 2 garage_command="$install_dir/garage -c $install_dir/garage.toml" # define node -$garage_command layout assign $node_id -z $domain -c $weight -t $domain +$garage_command layout assign $secret_node_id -z $domain -c $weight -t $domain # if there is enough node, apply layout apply_layout "$garage_command"