add explicit environment selector for drb_counter

This commit is contained in:
2026-03-19 08:05:46 -05:00
parent 0559ede912
commit 814ac1b808
+22 -1
View File
@@ -1,11 +1,32 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script rebuilds the whole environment and starts a new container # 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 # 1. ensure this script is run from the project's root, not the drb_counter directory
pwd_dirname=$(basename $(pwd)); pwd_dirname=$(basename $(pwd));
script_dirname="drb_counter"; script_dirname="drb_counter";
arch=$(uname) arch=$(uname)
environment="${1:-production}"
# Check for sanity, was debugging database mismatch # Check for sanity, was debugging database mismatch
if [ "$#" -lt 1 ]; then if [ "$#" -lt 1 ]; then