-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to validate required env vars
Add script to verify that all required env vars are supplied in the .env file
- Loading branch information
1 parent
d8a58d3
commit 039c054
Showing
2 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# List of required environment variables | ||
required_vars=( | ||
"DEVSPACE_IMAGE" | ||
"DEVSPACE_INGRESS_CIDRS" | ||
"DEVSPACE_INGRESS_BASE_DOMAIN" | ||
"DEVSPACE_INGRESS_CERT_ARN" | ||
"DEVSPACE_K8S_POD_WAIT_TIMEOUT" | ||
"NS_TTL" | ||
"DEVSPACE_CCIP_SCRIPTS_IMAGE" | ||
"DEVSPACE_CCIP_SCRIPTS_OIDC_ROLE_ARN" | ||
"DEVSPACE_CCIP_SCRIPTS_OUTPUT_BUCKET_NAME" | ||
) | ||
|
||
missing_vars=0 # Counter for missing variables | ||
|
||
# Check each variable | ||
for var in "${required_vars[@]}"; do | ||
if [ -z "${!var}" ]; then # If variable is unset or empty | ||
echo "Error: Environment variable $var is not set." | ||
missing_vars=$((missing_vars + 1)) | ||
fi | ||
done | ||
|
||
# Exit with an error if any variables were missing | ||
if [ $missing_vars -ne 0 ]; then | ||
echo "Total missing environment variables: $missing_vars" | ||
exit 1 | ||
else | ||
echo "All required environment variables are set." | ||
fi |