Skip to content

Commit

Permalink
Merge pull request #109 from kiloutyg/108-add-test-to-check-if-than-a…
Browse files Browse the repository at this point in the history
…nswers-has-been-given-during-installupdate-script-execution

added check to ensure no empty string has been passed in the variables
  • Loading branch information
kiloutyg authored Sep 5, 2024
2 parents 3e73837 + 8d75a10 commit 2deac28
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
14 changes: 11 additions & 3 deletions env_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,24 @@ while true; do
else
break
fi
if [ -z "${PLANT_TRIGRAM}" ]
then
echo "The plant trigram should not be empty. Please try again."
fi
done

# Ask the name of the site or plant
while true; do
read -p "Please enter the name of the facility or plant (example: Langres or Andance): " FACILITY_NAME
if is_FACILITY_name_valid "$FACILITY_NAME"; then
echo "The site name should contain the first letter uppercase. Please try again."
else
break
fi
else
break
fi
if [ -z "${FACILITY_NAME}" ]
then
echo "The site name should not be empty. Please try again."
fi
done


Expand Down
18 changes: 13 additions & 5 deletions env_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ is_FACILITY_name_valid() {

# Ask the name of the site or plant
while true; do
read -p "Please enter the name of the facility or plant (example: Langres or Andance): " FACILITY_NAME
if is_FACILITY_name_valid "$FACILITY_NAME"; then
read -p "Please enter the name of the facility or plant (example: Langres or Andance): " FACILITY_NAME
if is_FACILITY_name_valid "$FACILITY_NAME"; then
echo "The site name should contain the first letter uppercase. Please try again."
else
break
fi
else
break
fi
if [ -z "${FACILITY_NAME}" ]
then
echo "The site name should not be empty. Please try again."
fi
done

# Function to check for uppercase characters
Expand All @@ -32,6 +36,10 @@ while true; do
else
break
fi
if [ -z "${PLANT_TRIGRAM}" ]
then
echo "The plant trigram should not be empty. Please try again."
fi
done

# Load the environment variables from the .env file
Expand Down
4 changes: 4 additions & 0 deletions install-eFNC2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ sg docker -c "
else
break
fi
if [ -z "${GITHUB_USER}" ]
then
echo "The github user name should not be empty. Please try again."
fi
done

# Ask the user for the git repository address either in ssh or http
Expand Down

0 comments on commit 2deac28

Please sign in to comment.