feat(mosaic-portainer): add PORTAINER_INSECURE flag for self-signed TLS
Self-signed Portainer instances (e.g. internal LAN at 10.1.1.43:9443) caused all wrapper calls to fail silently with HTTP 000. Setting PORTAINER_INSECURE=1 passes -k to curl, bypassing certificate verification and unblocking API calls to such instances. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -54,12 +54,18 @@ fi
|
||||
# Remove trailing slash from URL
|
||||
PORTAINER_URL="${PORTAINER_URL%/}"
|
||||
|
||||
# TLS options
|
||||
CURL_OPTS=()
|
||||
if [ "${PORTAINER_INSECURE:-0}" = "1" ]; then
|
||||
CURL_OPTS+=(-k)
|
||||
fi
|
||||
|
||||
# Function to make API requests
|
||||
api_request() {
|
||||
local method="$1"
|
||||
local endpoint="$2"
|
||||
|
||||
curl -s -w "\n%{http_code}" -X "$method" \
|
||||
curl -s "${CURL_OPTS[@]}" -w "\n%{http_code}" -X "$method" \
|
||||
-H "X-API-Key: ${PORTAINER_API_KEY}" \
|
||||
"${PORTAINER_URL}${endpoint}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user