1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

docker/add-user.sh: Support getting email and password from env variables

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.

https://github.com/albertito/chasquid/pull/43

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Minor edits to the commit message.
This commit is contained in:
Ernesto Alfonso
2023-10-28 23:21:34 -04:00
committed by Alberto Bertogli
parent 6713fb7aef
commit 0ce84a3b5d

View File

@@ -7,16 +7,19 @@
set -e
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
if test -z "${PASSWORD:-}"; then
read -r -p "Password: " -s PASSWORD
echo
fi
DOMAIN=$(echo echo "${EMAIL}" | cut -d '@' -f 2)