Skip to content

Commit

Permalink
docker/add-user.sh: Support getting email and password from env varia…
Browse files Browse the repository at this point in the history
…bles

This patch extends docker/add-user.sh to support getting the email and
password from environment variables.

That way, docker/add-user.sh can be used in scripts.

#43

Amended-by: Alberto Bertogli <[email protected]>
  Minor edits to the commit message.
erjoalgo authored and albertito committed Oct 29, 2023
1 parent 6713fb7 commit 0ce84a3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docker/add-user.sh
Original file line number Diff line number Diff line change
@@ -7,16 +7,19 @@

set -e

read -r -p "Email (full user@domain format): " EMAIL
if test -z "${EMAIL:-}"; then
read -r -p "Email (full user@domain format): " EMAIL
fi

if ! echo "${EMAIL}" | grep -q @; then
echo "Error: email should have '@'."
exit 1
fi


read -r -p "Password: " -s PASSWORD
echo
if test -z "${PASSWORD:-}"; then
read -r -p "Password: " -s PASSWORD
echo
fi

DOMAIN=$(echo echo "${EMAIL}" | cut -d '@' -f 2)

0 comments on commit 0ce84a3

Please sign in to comment.