Skip to content

Commit

Permalink
Add proper error message if the variables are set twice
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentPoinsaut committed Mar 27, 2022
1 parent 2c97e6d commit eb7a190
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docker-volumes/smtpd/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ shopt -s nullglob
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local varName="${!var@}"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both ${varName} and ${fileVarName} are set (but are exclusive)"
echo >&2 "error: both ${varName} and ${fileVar} are set (but are mutually exclusive)"
exit 1
fi
local val="$def"
Expand Down

0 comments on commit eb7a190

Please sign in to comment.