From 58557dcd91f1257852d86ceebee71abcc7a4f73e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 23 Apr 2018 06:56:36 -0400 Subject: [PATCH] refactor: allow usage of the same variable to disable docker pulls --- config | 2 ++ functions | 4 ++-- install | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config b/config index d91fa6d..d8fe160 100644 --- a/config +++ b/config @@ -11,6 +11,8 @@ export PLUGIN_DATA_HOST_ROOT=$MONGO_HOST_ROOT export PLUGIN_DATASTORE_PORTS=(27017 27018 27019 28017) export PLUGIN_DATASTORE_WAIT_PORT=27017 export PLUGIN_DEFAULT_ALIAS="MONGO" +export PLUGIN_DISABLE_PULL=${MONGO_DISABLE_PULL:=} +export PLUGIN_DISABLE_PULL_VARIABLE="MONGO_DISABLE_PULL" export PLUGIN_ALT_ALIAS="DOKKU_MONGO" export PLUGIN_IMAGE=$MONGO_IMAGE export PLUGIN_IMAGE_VERSION=$MONGO_IMAGE_VERSION diff --git a/functions b/functions index 87f3617..43a547d 100755 --- a/functions +++ b/functions @@ -30,8 +30,8 @@ service_create() { service_parse_args "${@:2}" if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " ; then - if [[ "$MONGO_DISABLE_PULL" == "true" ]]; then - dokku_log_warn "MONGO_DISABLE_PULL environment variable detected. Not running pull command." 1>&2 + if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then + dokku_log_warn "${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2 dokku_log_warn " docker pull ${IMAGE}" 1>&2 dokku_log_warn "$PLUGIN_SERVICE service creation failed" exit 1 diff --git a/install b/install index 24916b6..a5cf182 100755 --- a/install +++ b/install @@ -5,8 +5,8 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x plugin-install() { pull-docker-image() { declare IMAGE="$1" - if [[ "$MONGO_DISABLE_PULL" == "true" ]]; then - echo " ! MONGO_DISABLE_PULL environment variable detected. Not running pull command." 1>&2 + if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then + echo " ! ${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2 echo " ! docker pull ${IMAGE}" 1>&2 return fi