From c36e6354b3ae0ee0a9c288d61e8fa37c5a53b345 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Thu, 1 Jul 2021 13:49:43 +1000 Subject: [PATCH] use true to activate xdebug --- images/php-cli/61-php-xdebug-cli-env.sh | 4 ++-- images/php-fpm/entrypoints/60-php-xdebug.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/images/php-cli/61-php-xdebug-cli-env.sh b/images/php-cli/61-php-xdebug-cli-env.sh index 3db4afa3f..e64bd3e0d 100755 --- a/images/php-cli/61-php-xdebug-cli-env.sh +++ b/images/php-cli/61-php-xdebug-cli-env.sh @@ -1,7 +1,7 @@ #!/bin/sh -# Only if XDEBUG_ENABLE is not empty -if [ ! -z ${XDEBUG_ENABLE} ]; then +# enable XDebug only if XDEBUG_ENABLE is set to true or TRUE or True +if expr "$XDEBUG_ENABLE" : '[Tt][Rr][Uu][Ee]' > /dev/null; then # XDEBUG_CONFIG is used by xdebug to decide if an xdebug session should be started in the CLI or not. # The content doesn't really matter it just needs to be set, the actual connection details are loaded from /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini export XDEBUG_CONFIG="idekey=lagoon" diff --git a/images/php-fpm/entrypoints/60-php-xdebug.sh b/images/php-fpm/entrypoints/60-php-xdebug.sh index 1d05a274f..3300d03e4 100755 --- a/images/php-fpm/entrypoints/60-php-xdebug.sh +++ b/images/php-fpm/entrypoints/60-php-xdebug.sh @@ -13,12 +13,12 @@ get_dockerhost() { return } -# Only if XDEBUG_ENABLE is not empty -if [ ! -z ${XDEBUG_ENABLE} ]; then +# enable XDebug only if XDEBUG_ENABLE is set to true or TRUE or True +if expr "$XDEBUG_ENABLE" : '[Tt][Rr][Uu][Ee]' > /dev/null; then # remove first line and all comments sed -i '1d; s/;//' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini # add comment that explains how we have xdebug enabled - sed -i '1s/^/;xdebug enabled as XDEBUG_ENABLE is not empty, see \/lagoon\/entrypoints\/60-php-xdebug.sh \n/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + sed -i '1s/^/;xdebug enabled as XDEBUG_ENABLE is set to true, see \/lagoon\/entrypoints\/60-php-xdebug.sh \n/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini # Only if DOCKERHOST is not already set, allows to set a DOCKERHOST via environment variables if [[ -z ${DOCKERHOST+x} ]]; then