Skip to content

Commit

Permalink
feat: use OpenVSX instance as configured in Che
Browse files Browse the repository at this point in the history
empty: use OpenVSX from the plug-in registry
defined: use that link

Change-Id: I9c349f435a399e23c38819e9f3d2d80e7b9a85b0
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
  • Loading branch information
benoitf committed Aug 24, 2022
1 parent 6382286 commit bc52fed
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions build/scripts/entrypoint-volume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,26 @@ if [ -z "$CODE_HOST" ]; then
CODE_HOST="127.0.0.1"
fi

# First, check if OPENVSX_REGISTRY_URL environment variable is defined
# If it is, then it means CheServer has a way to provide this information
if [ -n "${OPENVSX_REGISTRY_URL+x}" ]; then

# now check if it's empty, in that case we use Plugin Registry OpenVSX
if [ -z "$OPENVSX_REGISTRY_URL" ]; then
# remove the suffix /v3 from this variable
CHE_PLUGIN_REGISTRY_ROOT_URL=${CHE_PLUGIN_REGISTRY_URL%/v3}

# Use OpenVSX of the plug-in registry
OPENVSX_URL="$CHE_PLUGIN_REGISTRY_ROOT_URL/openvsx/vscode"
else
# Use OpenVSX URL provided by the env variable
OPENVSX_URL="$OPENVSX_REGISTRY_URL"
fi
echo "using OPENVSX_URL=$OPENVSX_URL"
sed -i -r -e "s|\"serviceUrl\": \"..*\"|\"serviceUrl\": \"${OPENVSX_URL}/gallery\"|" product.json
sed -i -r -e "s|\"itemUrl\": \"..*\"|\"itemUrl\": \"${OPENVSX_URL}/item\"|" product.json
sed -i -e "s|serviceUrl:\".*\",itemUrl:\".*\"},version|serviceUrl:\"${OPENVSX_URL}/gallery\",itemUrl:\"${OPENVSX_URL}/item\"},version|" out/vs/workbench/workbench.web.main.js
fi

# Launch che without connection-token, security is managed by Che
./node out/server-main.js --host "${CODE_HOST}" --port 3100 --without-connection-token

0 comments on commit bc52fed

Please sign in to comment.