Created
May 23, 2019 19:45
-
-
Save gtalarico/292a8ff606531073235bd56bd414e3c5 to your computer and use it in GitHub Desktop.
Assert Environment Variables are set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Asserts given env vars are set | |
# Usage: assert_envs { args } | |
# eg. DBHOST DBPORT DBNAME DBUSER | |
assert_envs() { | |
for var in "$@"; do | |
if [ -z "${!var}" ]; then | |
error "$var environment is required and is not set" | |
exit 1 | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment