From 814ac1b808405ed68136847a4c7849e6270eac8d Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Thu, 19 Mar 2026 08:05:46 -0500 Subject: [PATCH] add explicit environment selector for drb_counter --- drb_counter/rebuild-docker.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drb_counter/rebuild-docker.sh b/drb_counter/rebuild-docker.sh index 3fe03106..1a57f731 100755 --- a/drb_counter/rebuild-docker.sh +++ b/drb_counter/rebuild-docker.sh @@ -1,11 +1,32 @@ #!/usr/bin/env bash # This script rebuilds the whole environment and starts a new container +# +# Set the prompt message +environments=("production" "development" "test" "Quit") +echo "Choose the environment (1-3): " +for i in "${!environments[@]}"; do + echo "$((i+1))) ${environments[$i]}" +done + +read -p "Enter number: " choice + +if [[ $choice -eq ${#environments[@]} ]]; then + exit 0 +fi + +# Validate and use the choice (subtract 1 for 0-based array index) +if [[ $choice -gt 0 && $choice -lt ${#environments[@]} ]]; then + environment=${environments[$((choice-1))]} + echo "You selected: $environment" +else + echo "Invalid selection." + exit 0 +fi # 1. ensure this script is run from the project's root, not the drb_counter directory pwd_dirname=$(basename $(pwd)); script_dirname="drb_counter"; arch=$(uname) -environment="${1:-production}" # Check for sanity, was debugging database mismatch if [ "$#" -lt 1 ]; then