Skip to content

Commit

Permalink
Update script to use shorthands for env verification
Browse files Browse the repository at this point in the history
  • Loading branch information
psx95 committed Sep 13, 2024
1 parent 9e90479 commit 1ae6ffc
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions examples/spring/run_in_cloud-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,12 @@
#
CONTAINER_REGISTRY=cloud-run-applications
REGISTRY_LOCATION=us-central1
UNSET_WARNING="Environment variable not set, please set the environment variable"

if [[ -z "${GOOGLE_CLOUD_PROJECT}" ]]; then
echo "GOOGLE_CLOUD_PROJECT environment variable not set"
exit 1
fi

if [[ -z "${GOOGLE_APPLICATION_CREDENTIALS}" ]]; then
echo "GOOGLE_APPLICATION_CREDENTIALS environment variable not set"
exit 1
fi

if [[ -z "${GOOGLE_CLOUD_RUN_REGION}" ]]; then
echo "GOOGLE_CLOUD_RUN_REGION environment variable not set"
exit 1
fi
# Verify necessary environment variables are set
echo "${GOOGLE_CLOUD_PROJECT:?${UNSET_WARNING}}"
echo "${GOOGLE_APPLICATION_CREDENTIALS:?${UNSET_WARNING}}"
echo "${GOOGLE_CLOUD_RUN_REGION:?${UNSET_WARNING}}"

echo "ENVIRONMENT VARIABLES VERIFIED"
set -x
Expand Down

0 comments on commit 1ae6ffc

Please sign in to comment.