Skip to content

Commit

Permalink
Helper command to launch website
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler36 committed Nov 9, 2023
1 parent 390da3f commit f321f43
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ Profiling in a production environment is not recommended.
The service will automatically start when run: `ddev start` or `ddev restart`.
By default, xhgui will be available at `https://yourproject.ddev.site:8143`.
Use the following command to launch the xhgui in your browser:
```shell
ddev xhgui
```
For detailed information about a single request, click on the "Method" keyword on the "Recent runs" dashboard.
Expand Down
51 changes: 51 additions & 0 deletions commands/host/xhgui
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

## #ddev-generated
## Description: Launch a browser to XHGui
## Usage: xhgui
## Example: "xhgui"

DDEV_XHGUI_PORT=8142
DDEV_XHGUI_HTTPS_PORT=8143

FULLURL=${DDEV_PRIMARY_URL}
HTTPS=""
if [ ${DDEV_PRIMARY_URL%://*} = "https" ]; then HTTPS=true; fi

if [[ ! -z "${GITPOD_INSTANCE_ID}" ]] || [[ "${CODESPACES}" == "true" ]]; then
FULLURL="${FULLURL/-${DDEV_HOST_WEBSERVER_PORT}/-${DDEV_XHGUI_PORT}}"
else
if [ "${HTTPS}" = "" ]; then
FULLURL="${FULLURL%:[0-9]*}:${DDEV_XHGUI_PORT}"
else
FULLURL="${FULLURL%:[0-9]*}:${DDEV_XHGUI_HTTPS_PORT}"
fi
fi

if [ -n "${1:-}" ]; then
if [[ ${1::1} != "/" ]]; then
FULLURL="${FULLURL}/"
fi

FULLURL="${FULLURL}${1}"
fi

if [ "${DDEV_DEBUG:-}" = "true" ]; then
printf "FULLURL $FULLURL\n" && exit 0
fi

case $OSTYPE in
linux-gnu)
if [[ ! -z "${GITPOD_INSTANCE_ID}" ]]; then
gp preview ${FULLURL}
else
xdg-open ${FULLURL}
fi
;;
"darwin"*)
open ${FULLURL}
;;
"win*"* | "msys"*)
start ${FULLURL}
;;
esac
1 change: 1 addition & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: xhgui

project_files:
- docker-compose.xhgui.yaml
- commands/host/xhgui
- xhgui/Dockerfile
- xhgui/xhgui.config.php
- xhgui/collector/xhgui.collector.config.php
Expand Down

0 comments on commit f321f43

Please sign in to comment.