diff --git a/commands/host/adminer b/commands/host/adminer index 005d326..180c197 100755 --- a/commands/host/adminer +++ b/commands/host/adminer @@ -5,60 +5,11 @@ ## Usage: adminer ## Example: "ddev adminer" -if [ "${DDEV_PROJECT_STATUS-running}" != "running" ] && [ -z "$no_recursion" ]; then - echo "Project ${DDEV_PROJECT} is not running, starting it" - ddev start - start_exit_code=$? - if [ $start_exit_code -ne 0 ]; then - exit $start_exit_code - fi - # run this script again, as the environment is updated after "ddev start" - no_recursion=true ddev "$(basename "$0")" "$@" - exit $? -fi - 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}}" +if [ ${DDEV_PRIMARY_URL%://*} = "https" ]; then + ddev launch $DDEV_PRIMARY_URL:$DDEV_ADMINER_HTTPS_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 + ddev launch $DDEV_PRIMARY_URL:$DDEV_ADMINER_PORT 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 - diff --git a/commands/host/launcha b/commands/host/launcha deleted file mode 100755 index c62f58f..0000000 --- a/commands/host/launcha +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -#ddev-generated -## Description: DEPRECATED, use "ddev adminer" instead. -printf "'ddev launcha' is no longer available. Use 'ddev launch' and 'ddev adminer' instead. See https://github.com/ddev/ddev-adminer" -exit 2 diff --git a/docker-compose.adminer.yaml b/docker-compose.adminer.yaml index 8ddf985..dabc228 100644 --- a/docker-compose.adminer.yaml +++ b/docker-compose.adminer.yaml @@ -19,6 +19,9 @@ services: labels: com.ddev.site-name: ${DDEV_SITENAME} com.ddev.approot: $DDEV_APPROOT + volumes: + - ".:/mnt/ddev_config" + - "ddev-global-cache:/mnt/ddev-global-cache" depends_on: - db diff --git a/install.yaml b/install.yaml index 0d4e3cb..ea37cf7 100644 --- a/install.yaml +++ b/install.yaml @@ -4,7 +4,11 @@ name: adminer project_files: - docker-compose.adminer.yaml - adminer - -global_files: - commands/host/adminer -- commands/host/launcha + +pre_install_actions: + # Ensure we're on DDEV 1.23+. It's required for the `adminer` command (launch by port). + - | + #ddev-nodisplay + #ddev-description:Checking DDEV version + (ddev debug capabilities | grep corepack >/dev/null) || (echo "Please upgrade DDEV to v1.23+ to use this add-on." && false) diff --git a/tests/test.bats b/tests/test.bats index 710696e..098fddd 100644 --- a/tests/test.bats +++ b/tests/test.bats @@ -25,15 +25,6 @@ teardown() { (ddev restart >/dev/null || (echo "# ddev restart returned exit code=%?" >&3 && false)) ddev help adminer | grep adminer >/dev/null - # ddev launcha must return an error - (exit_status=0; (ddev launcha > /dev/null 2>&1) || exit_status=$?; echo $exit_status) | { - read exit_status - if [ $exit_status -eq 0 ]; then - echo "Test failed: ddev launcha exited with no error" - exit 2 - fi - } - # 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 }