diff --git a/deploy-chunked.sh b/deploy-chunked.sh index 06c3e38..94358cb 100644 --- a/deploy-chunked.sh +++ b/deploy-chunked.sh @@ -45,6 +45,11 @@ CF_SKIP_SSL="false" # Use "true" for self-signed certificates POLL_INTERVAL=5 # seconds between status checks MAX_WAIT=600 # maximum wait time in seconds (10 minutes) +# Security configuration (optional) +CERT_FILE="" # Path to client certificate file (leave empty to skip) +X_FORWARDED_FOR="" # X-Forwarded-For header value (leave empty to skip) +MY_APIM_KEY="" # My-APIM-KEY header value (leave empty to skip) + ############################################################################# # SCRIPT - Do not modify below this line ############################################################################# @@ -90,6 +95,24 @@ if ! command -v curl &> /dev/null; then exit 1 fi +# Build curl options based on configuration +CURL_OPTS="" +if [ -n "$CERT_FILE" ]; then + if [ ! -f "$CERT_FILE" ]; then + log_error "Certificate file not found: $CERT_FILE" + exit 1 + fi + CURL_OPTS="$CURL_OPTS --cert $CERT_FILE" +fi + +if [ -n "$X_FORWARDED_FOR" ]; then + CURL_OPTS="$CURL_OPTS -H \"X-Forwarded-For: $X_FORWARDED_FOR\"" +fi + +if [ -n "$MY_APIM_KEY" ]; then + CURL_OPTS="$CURL_OPTS -H \"My-APIM-KEY: $MY_APIM_KEY\"" +fi + # Build CF configuration JSON CF_CONFIG=$(cat </dev/null) + STATUS_RESPONSE=$(eval curl -s "$API_BASE/deployment/status/$SESSION_ID" \ + $CURL_OPTS 2>/dev/null) if [ $? -ne 0 ]; then log_warning "Failed to fetch status, retrying..."