Fix NPM forward host: use real host IP instead of Docker gateway

- npm_service._get_forward_host() now detects the actual host IP via
  UDP socket (works inside Docker containers) instead of using
  172.17.0.1 Docker gateway which NPM can't reach
- install.sh uses hostname -I for NPM forward host
- Removed npm_api_url parameter from _get_forward_host()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 20:45:01 +01:00
parent 55e2c3b80b
commit b56f0eb8a4
3 changed files with 20 additions and 32 deletions

View File

@@ -442,15 +442,8 @@ if [ -n "$MSP_DOMAIN" ]; then
echo ""
echo -e "${CYAN}Creating NPM proxy host for MSP Appliance (${MSP_DOMAIN})...${NC}"
# Determine forward host from NPM API URL
NPM_HOST=$(echo "$NPM_API_URL" | sed -E 's|https?://([^:/]+).*|\1|')
# If host looks like a container name (no dots), use Docker gateway
if ! echo "$NPM_HOST" | grep -q '\.'; then
FORWARD_HOST="172.17.0.1"
else
FORWARD_HOST="$NPM_HOST"
fi
# Use the actual host IP for NPM forwarding (not Docker gateway!)
FORWARD_HOST=$(hostname -I | awk '{print $1}')
# Step 1: Login to NPM
NPM_TOKEN=$(curl -s -X POST "${NPM_API_URL}/tokens" \