Spaces:
Running
Running
File size: 1,105 Bytes
0018f4b 1b5678f 0018f4b 1b5678f 0018f4b 1b5678f e07dc1f 1b5678f 0018f4b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/bin/sh
set -e # Exit immediately if a command exits with a non-zero status.
CREDENTIALS_FILE_PATH="/app/vella_gcp_luan_credentials.json"
# Check if the GCP_CREDENTIALS_JSON_CONTENT secret is provided
if [ -n "$GCP_CREDENTIALS_JSON_CONTENT" ]; then
echo "GCP_CREDENTIALS_JSON_CONTENT secret found. Writing to $CREDENTIALS_FILE_PATH"
# Use printf to preserve newlines and special characters correctly
printf "%s" "$GCP_CREDENTIALS_JSON_CONTENT" > "$CREDENTIALS_FILE_PATH"
export GOOGLE_APPLICATION_CREDENTIALS="$CREDENTIALS_FILE_PATH"
echo "GOOGLE_APPLICATION_CREDENTIALS set to $CREDENTIALS_FILE_PATH"
# Optional: Add a check to see if the file looks like JSON (basic check)
if command -v jq >/dev/null && jq -e . "$CREDENTIALS_FILE_PATH" >/dev/null 2>&1; then
echo "Credentials file appears to be valid JSON."
else
echo "Warning: Credentials file may not be valid JSON. Content:"
# cat "$CREDENTIALS_FILE_PATH" # Print the content for debugging
fi
else
echo "Warning: GCP_CREDENTIALS_JSON_CONTENT secret not found. GCP services might not authenticate."
fi
exec "$@" |