Browse Source

feat: Added advanced options

pull/8291/head
Rohit T P 7 months ago
parent
commit
656d003d52
  1. 47
      docker-compose/setup-script/noco.sh

47
docker-compose/setup-script/noco.sh

@ -62,6 +62,42 @@ check_for_docker_compose_sudo() {
fi fi
} }
# Function to read a number from the user
read_number() {
local number
read -p "$1" number
# Ensure the input is a number or empty
while ! [[ $number =~ ^[0-9]+$ ]] && [ -n "$number" ] ; do
read -p "Please enter a valid number: " number
done
echo $number
}
# Function to read a number within a range from the user
read_number_range() {
local number, min, max
# Check if there are 3 arguments
if [ "$#" -ne 3 ]; then
number=$(read_number)
min=$1
max=$2
else
number=$(read_number "$1")
min=$2
max=$3
fi
# Ensure the input is in the specified range
while [[ -n "$number" && ($number -lt $min || $number -gt $max) ]]; do
number=$(read_number "Please enter a number between $min and $max: ")
done
echo $number
}
# ***************** HELPER FUNCTIONS END *********************************** # ***************** HELPER FUNCTIONS END ***********************************
# ****************************************************************************** # ******************************************************************************
@ -213,7 +249,18 @@ else
message_arr+=("Watchtower: Disabled") message_arr+=("Watchtower: Disabled")
fi fi
echo "Show Advanced Options [Y/N] (default: N): "
read ADVANCED_OPTIONS
if [ -n "$ADVANCED_OPTIONS" ] && { [ "$ADVANCED_OPTIONS" = "Y" ] || [ "$ADVANCED_OPTIONS" = "y" ]; }; then
NUM_CORES=$(nproc)
echo "How many instances of NocoDB do you want to run? (Maximum: ${NUM_CORES} (default: 1): "
NUM_INSTANCES=$(read_number_range 1 $NUM_CORE
fi
if [ -z "$NUM_INSTANCES" ]; then
NUM_INSTANCES=1
fi
# ****************************************************************************** # ******************************************************************************
# *********************** INPUTS FROM USER END ******************************** # *********************** INPUTS FROM USER END ********************************

Loading…
Cancel
Save