From 9f1bb2784c5beefcdad157df5b77704d25cd5322 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 May 2016 02:58:00 -0400 Subject: [PATCH] Rework how config vars are sourced - ensure we source config/functions from the correct directory - move config sourcing up before DOKKU_TRACE to reduce trace output --- commands | 4 ++-- functions | 2 +- install | 2 +- pre-delete | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commands b/commands index 71cc3b4..200e524 100755 --- a/commands +++ b/commands @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x PLUGIN_BASE_PATH="$PLUGIN_PATH" @@ -6,8 +7,7 @@ if [[ -n $DOKKU_API_VERSION ]]; then PLUGIN_BASE_PATH="$PLUGIN_ENABLED_PATH" fi source "$PLUGIN_BASE_PATH/common/functions" -source "$(dirname "$0")/functions" -source "$(dirname "$0")/config" +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/functions" if [[ $1 == $PLUGIN_COMMAND_PREFIX:* ]]; then if [[ ! -d $PLUGIN_DATA_ROOT ]]; then diff --git a/functions b/functions index 8f7c617..65d244b 100755 --- a/functions +++ b/functions @@ -1,6 +1,6 @@ #!/usr/bin/env bash +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$(dirname "$0")/config" source "$PLUGIN_AVAILABLE_PATH/config/functions" get_random_ports() { diff --git a/install b/install index ee439da..170e018 100755 --- a/install +++ b/install @@ -1,6 +1,6 @@ #!/usr/bin/env bash +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$(dirname "$0")/config" if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q "$PLUGIN_IMAGE_VERSION" ; then docker pull "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" diff --git a/pre-delete b/pre-delete index 22897dc..403cad4 100755 --- a/pre-delete +++ b/pre-delete @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x PLUGIN_BASE_PATH="$PLUGIN_PATH" @@ -6,8 +7,7 @@ if [[ -n $DOKKU_API_VERSION ]]; then PLUGIN_BASE_PATH="$PLUGIN_ENABLED_PATH" fi source "$PLUGIN_BASE_PATH/common/functions" -source "$(dirname "$0")/functions" -source "$(dirname "$0")/config" +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/functions" APP="$1" for SERVICE in "$PLUGIN_DATA_ROOT"/*; do