diff --git a/lib/functions.sh b/lib/functions.sh index c524dd4..3d5a88f 100755 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -80,6 +80,23 @@ fetchVarsFromVaultByFile() { return 0 } +assertVarsNotEmpty() { + MISSING_VARS="" + + for VAR in $@; do + if [ -z "${!VAR}" ]; then + MISSING_VARS+="$VAR " + fi + done + + if [ -n "$MISSING_VARS" ]; then + log "ERROR" "Mandatory variables not defined: $MISSING_VARS" + return 1 + fi + + return 0 +} + ##Setting Network properties export HOSTIP=$(MSYS_NO_PATHCONV=1 docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}'); export HOST=$(hostname)