Skip to content

Instantly share code, notes, and snippets.

@gtalarico
Created May 23, 2019 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gtalarico/292a8ff606531073235bd56bd414e3c5 to your computer and use it in GitHub Desktop.
Save gtalarico/292a8ff606531073235bd56bd414e3c5 to your computer and use it in GitHub Desktop.
Assert Environment Variables are set
# 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