diff --git a/code-server/main.tf b/code-server/main.tf index 9961693..a6ebe35 100644 --- a/code-server/main.tf +++ b/code-server/main.tf @@ -141,6 +141,8 @@ resource "coder_script" "code-server" { EXTENSIONS_DIR : var.extensions_dir, FOLDER : var.folder, AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions, + SERVER_BASE_PATH : format("/%s/%s.%s/apps/vscode-web/", + data.coder_workspace_owner.name, data.coder_workspace.name, "main"), }) run_on_start = true diff --git a/vscode-web/run.sh b/vscode-web/run.sh index ce8782f..6808de6 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -10,10 +10,16 @@ if [ -n "${EXTENSIONS_DIR}" ]; then EXTENSION_ARG="--extensions-dir=${EXTENSIONS_DIR}" fi +# Set extension directory +SERVER_BASE_PATH="" +if [ -n "${SERVER_BASE_PATH}" ]; then + SERVER_BASE_PATH="--server-base-path=${SERVER_BASE_PATH}" +fi + run_vscode_web() { - echo "👷 Running $VSCODE_WEB serve-local $EXTENSION_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..." + echo "👷 Running $VSCODE_WEB serve-local $EXTENSION_ARG $SERVER_BASE_PATH --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..." echo "Check logs at ${LOG_PATH}!" - "$VSCODE_WEB" serve-local "$EXTENSION_ARG" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level "${TELEMETRY_LEVEL}" > "${LOG_PATH}" 2>&1 & + "$VSCODE_WEB" serve-local "$EXTENSION_ARG" "${SERVER_BASE_PATH}" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level "${TELEMETRY_LEVEL}" > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists...