diff --git a/plugins/00_dokku-standard/exec-app-json-scripts b/plugins/00_dokku-standard/exec-app-json-scripts index e90457b2c..8077e7a65 100755 --- a/plugins/00_dokku-standard/exec-app-json-scripts +++ b/plugins/00_dokku-standard/exec-app-json-scripts @@ -57,7 +57,7 @@ execute_script() { # eval args as array to respect escapes declare -a ARG_ARRAY - eval ARG_ARRAY=($DOCKER_ARGS) + eval "ARG_ARRAY=($DOCKER_ARGS)" local id=$(docker run "$DOKKU_GLOBAL_RUN_ARGS" -e DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" /bin/bash -c "$COMMAND") if test "$(docker wait "$id")" -eq 0; then diff --git a/plugins/00_dokku-standard/pre-deploy b/plugins/00_dokku-standard/pre-deploy index ec8b1ba30..c21ccc7fc 100755 --- a/plugins/00_dokku-standard/pre-deploy +++ b/plugins/00_dokku-standard/pre-deploy @@ -29,7 +29,7 @@ app_user_pre_deploy_trigger() { if [[ -n "$APP_PATHS" ]]; then CONTAINER_PATHS=$(echo "$APP_PATHS" | awk -F ':' '{ print $2 }' | xargs) DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG") - eval ARG_ARRAY=($DOCKER_ARGS) + eval "ARG_ARRAY=($DOCKER_ARGS)" fi if [[ "$DOKKU_APP_TYPE" == "herokuish" ]] && [[ -n "$CONTAINER_PATHS" ]]; then diff --git a/plugins/00_dokku-standard/subcommands/run b/plugins/00_dokku-standard/subcommands/run index 9f5f6aa41..a0dc3cbd2 100755 --- a/plugins/00_dokku-standard/subcommands/run +++ b/plugins/00_dokku-standard/subcommands/run @@ -23,7 +23,7 @@ dokku_run_cmd() { [[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true " declare -a ARG_ARRAY - eval ARG_ARRAY=($DOCKER_ARGS) + eval "ARG_ARRAY=($DOCKER_ARGS)" local DOKKU_RUN_OPTS=" -e DYNO=run.$RANDOM" if [[ "$DOKKU_RM_CONTAINER" ]]; then diff --git a/plugins/common/functions b/plugins/common/functions index eb306ebf7..1db8dba99 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -459,7 +459,7 @@ dokku_build() { local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE") [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " declare -a ARG_ARRAY - eval ARG_ARRAY=($DOCKER_ARGS) + eval "ARG_ARRAY=($DOCKER_ARGS)" # shellcheck disable=SC2086 local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache "${ARG_ARRAY[@]}" $IMAGE /build) docker attach "$id" @@ -486,7 +486,7 @@ dokku_build() { # strip --volume and -v args from DOCKER_ARGS local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS") declare -a ARG_ARRAY - eval ARG_ARRAY=($DOCKER_ARGS) + eval "ARG_ARRAY=($DOCKER_ARGS)" # shellcheck disable=SC2086 docker build "${ARG_ARRAY[@]}" $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE . @@ -588,7 +588,7 @@ dokku_deploy_cmd() { [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " declare -a ARG_ARRAY - eval ARG_ARRAY=($DOCKER_ARGS) + eval "ARG_ARRAY=($DOCKER_ARGS)" [[ -n "$DOKKU_HEROKUISH" ]] && local START_CMD="/start $PROC_TYPE" diff --git a/plugins/config/functions b/plugins/config/functions index 0dda7d76e..f2787a170 100755 --- a/plugins/config/functions +++ b/plugins/config/functions @@ -2,39 +2,44 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +config_sub(){ + declare desc="executes a config subcommand" + local name="$1" + shift + "$PLUGIN_AVAILABLE_PATH/config/subcommands/$name" "config:$name" "$@" +} + config_export() { declare desc="returns export command for config variable of specified type (app/global)" local CONFIG_TYPE="$1" - local APP="$2" + shift + local APP="$1" if [[ $CONFIG_TYPE == "global" ]]; then APP="--global" + else + shift fi - $PLUGIN_AVAILABLE_PATH/config/subcommands/export config:export "$APP" + config_sub export "$@" "$APP" return 0 } config_keys() { declare desc="returns keys for app or global" - local CONFIG_TYPE="$1" - local APP="$2" - if [[ $CONFIG_TYPE == "global" ]]; then - APP="--global" - fi - $PLUGIN_AVAILABLE_PATH/config/subcommands/export config:export --keys "$APP" + config_export "$@" "--keys" return 0 } config_get() { declare desc="get value of given config var" - $PLUGIN_AVAILABLE_PATH/config/subcommands/get config:get "$@" + config_sub get "$@" } config_set() { declare desc="set value of given config var" - $PLUGIN_AVAILABLE_PATH/config/subcommands/set config:set "$@" + config_sub set "$@" } config_unset() { declare desc="set value of given config var" - $PLUGIN_AVAILABLE_PATH/config/subcommands/unset config:unset "$@" + config_sub unset "$@" }