New function assertVarsNotEmpty()

This commit is contained in:
Martin Lablans 2022-05-31 13:56:12 +02:00
parent 57483e78d4
commit 37d954e304
1 changed files with 17 additions and 0 deletions

View File

@ -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)