Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch with ddev adminer instead of launcha -a #16

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ This currently supports:

* `ddev get ddev/ddev-adminer && ddev restart`

Then you can just `ddev launcha -a` or use `ddev describe` to get the URL (`https://<project>.ddev.site:9101`).
Then you can just `ddev adminer` or use `ddev describe` to get the URL (`https://<project>.ddev.site:9101`).

## What does this add-on do?

* Adds the adminer container as a service
* Adds a `ddev launcha` command at the project level with a `ddev launcha -a` (or `ddev launcha --adminer`) option to launch you right into adminer.

**Contributed by [@bserem](https://github.com/bserem).**
**Maintained by DDEV team.**
52 changes: 52 additions & 0 deletions commands/host/adminer
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

## #ddev-generated: If you want to edit and own this file, remove this line.
## Description: Launch a browser with Adminer
## Usage: adminer
## Example: "ddev adminer"

DDEV_ADMINER_PORT=9100
DDEV_ADMINER_HTTPS_PORT=9101

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_ADMINER_PORT}}"
else
if [ "${HTTPS}" = "" ]; then
FULLURL="${FULLURL%:[0-9]*}:${DDEV_ADMINER_PORT}"
else
FULLURL="${FULLURL%:[0-9]*}:${DDEV_ADMINER_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

2 changes: 1 addition & 1 deletion commands/host/launcha
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

#ddev-generated
## Description: Launch a browser with the current site
## Description: DEPRECATED, use "ddev adminer" instead.
## Usage: launcha [path] [-a|--adminer] [-p|--phpmyadmin] [-m|--mailhog]
## Example: "ddev launcha" or "ddev launcha /admin/reports/status/php" or "ddev launcha phpinfo.php", for Adminer "ddev launcha -a", MailHog "ddev launch -m"

Expand Down
1 change: 1 addition & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ project_files:
- adminer

global_files:
- commands/host/adminer
- commands/host/launcha
1 change: 1 addition & 0 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ teardown() {
echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
ddev get ${DIR}
(ddev restart >/dev/null || (echo "# ddev restart returned exit code=%?" >&3 && false))
ddev help adminer | grep adminer >/dev/null
ddev help launcha | grep adminer >/dev/null
# echo "# Trying curl -s -L -k https://${PROJNAME}.ddev.site:9101/" >&3
curl --fail -s -L -k https://${PROJNAME}.ddev.site:9101/ | grep 'document.querySelector.*auth.*db' >/dev/null
Expand Down
Loading