From a1a1d2509ae37a2d80f554416774271506d7189f Mon Sep 17 00:00:00 2001 From: Yury Kossakovsky Date: Wed, 14 May 2025 14:35:05 -0600 Subject: [PATCH] Enhance user prompts in 03_generate_secrets.sh and apply_update.sh - Updated prompts to use printf for better formatting, ensuring dynamic inclusion of variable values in user messages. - Improved user experience by making prompts clearer and more informative during input collection. --- scripts/03_generate_secrets.sh | 10 +++++----- scripts/apply_update.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/03_generate_secrets.sh b/scripts/03_generate_secrets.sh index 3a685ed..3dc0d22 100755 --- a/scripts/03_generate_secrets.sh +++ b/scripts/03_generate_secrets.sh @@ -105,7 +105,7 @@ while true; do fi echo "" - read -p $"Are you sure '$DOMAIN' is correct? (y/N): \n" confirm_domain + read -p "$(printf "Are you sure '%s' is correct? (y/N): \n" "$DOMAIN")" confirm_domain if [[ "$confirm_domain" =~ ^[Yy]$ ]]; then break # Confirmed, exit loop else @@ -142,7 +142,7 @@ else fi echo "" - read -p $"Are you sure '$USER_EMAIL' is correct? (y/N): \n" confirm_email + read -p "$(printf "Are you sure '%s' is correct? (y/N): \n" "$USER_EMAIL")" confirm_email if [[ "$confirm_email" =~ ^[Yy]$ ]]; then break # Confirmed, exit loop else @@ -193,7 +193,7 @@ if [[ -n "${existing_env_vars[N8N_WORKER_COUNT]}" ]]; then N8N_WORKER_COUNT_CURRENT="${existing_env_vars[N8N_WORKER_COUNT]}" log_info "Found existing N8N_WORKER_COUNT in .env: $N8N_WORKER_COUNT_CURRENT" echo "" - read -p $"Do you want to change the number of n8n workers? Current: $N8N_WORKER_COUNT_CURRENT. (Enter new number, or press Enter to keep current): \n" N8N_WORKER_COUNT_INPUT_RAW + read -p "$(printf "Do you want to change the number of n8n workers? Current: %s. (Enter new number, or press Enter to keep current): \n" "$N8N_WORKER_COUNT_CURRENT")" N8N_WORKER_COUNT_INPUT_RAW if [[ -z "$N8N_WORKER_COUNT_INPUT_RAW" ]]; then N8N_WORKER_COUNT="$N8N_WORKER_COUNT_CURRENT" log_info "Keeping N8N_WORKER_COUNT at $N8N_WORKER_COUNT." @@ -203,7 +203,7 @@ if [[ -n "${existing_env_vars[N8N_WORKER_COUNT]}" ]]; then N8N_WORKER_COUNT_TEMP="$((10#$N8N_WORKER_COUNT_INPUT_RAW))" # Sanitize (e.g. 01 -> 1) if [[ "$N8N_WORKER_COUNT_TEMP" -ge 1 ]]; then echo "" - read -p $"Update n8n workers to $N8N_WORKER_COUNT_TEMP? (y/N): \n" confirm_change + read -p "$(printf "Update n8n workers to %s? (y/N): \n" "$N8N_WORKER_COUNT_TEMP")" confirm_change if [[ "$confirm_change" =~ ^[Yy]$ ]]; then N8N_WORKER_COUNT="$N8N_WORKER_COUNT_TEMP" log_info "N8N_WORKER_COUNT set to $N8N_WORKER_COUNT." @@ -230,7 +230,7 @@ else N8N_WORKER_COUNT_VALIDATED="$((10#$N8N_WORKER_COUNT_CANDIDATE))" if [[ "$N8N_WORKER_COUNT_VALIDATED" -ge 1 ]]; then echo "" - read -p $"Run $N8N_WORKER_COUNT_VALIDATED n8n worker(s)? (y/N): \n" confirm_workers + read -p "$(printf "Run %s n8n worker(s)? (y/N): \n" "$N8N_WORKER_COUNT_VALIDATED")" confirm_workers if [[ "$confirm_workers" =~ ^[Yy]$ ]]; then N8N_WORKER_COUNT="$N8N_WORKER_COUNT_VALIDATED" log_info "N8N_WORKER_COUNT set to $N8N_WORKER_COUNT." diff --git a/scripts/apply_update.sh b/scripts/apply_update.sh index 2a1b119..36e9df3 100755 --- a/scripts/apply_update.sh +++ b/scripts/apply_update.sh @@ -64,7 +64,7 @@ if [ -f "$ENV_FILE" ]; then CURRENT_WORKER_COUNT=$(grep "^N8N_WORKER_COUNT=" "$ENV_FILE" | cut -d'=' -f2 | tr -d '"') log_info "Current n8n worker count: $CURRENT_WORKER_COUNT" echo "" - read -p $"Enter new n8n worker count (leave empty to keep current: $CURRENT_WORKER_COUNT): \n" new_worker_count_raw + read -p "$(printf "Enter new n8n worker count (leave empty to keep current: %s): \n" "$CURRENT_WORKER_COUNT")" new_worker_count_raw if [[ -n "$new_worker_count_raw" ]]; then # Validate input: must be a positive integer