mirror of
https://github.com/dokku/dokku.git
synced 2026-02-24 04:00:36 +01:00
don't run dokku again on --* args in config plugin
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
DOKKU_CONFIG_RESTART=${DOKKU_CONFIG_RESTART:=true}
|
||||
|
||||
config_create () {
|
||||
[ -f $ENV_FILE ] || {
|
||||
touch $ENV_FILE
|
||||
@@ -24,7 +22,7 @@ config_styled_hash () {
|
||||
|
||||
while read -r word; do
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//")
|
||||
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//" -e "s/\$$//g")
|
||||
|
||||
num_zeros=$((${#longest} - ${#KEY}))
|
||||
zeros=" "
|
||||
@@ -56,19 +54,26 @@ parse_config_args() {
|
||||
DOKKU_CONFIG_RESTART=false
|
||||
;;
|
||||
--no-restart)
|
||||
ARGS=("$@") && shift 2
|
||||
DOKKU_CONFIG_RESTART=false dokku ${ARGS[0]} "$@"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
ENV_FILE="$DOKKU_ROOT/$2/ENV"
|
||||
APP="$3"
|
||||
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
DOKKU_CONFIG_RESTART=false
|
||||
DOKKU_CONFIG_TYPE="app"
|
||||
set -- "${@:1:1}" "${@:3}"
|
||||
esac
|
||||
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
APP=${APP:="$2"}
|
||||
ENV_FILE=${ENV_FILE:="$DOKKU_ROOT/$APP/ENV"}
|
||||
DOKKU_CONFIG_TYPE=${DOKKU_CONFIG_TYPE:="app"}
|
||||
DOKKU_CONFIG_RESTART=${DOKKU_CONFIG_RESTART:=true}
|
||||
|
||||
if [[ "$DOKKU_CONFIG_TYPE" = "app" ]]; then
|
||||
if [[ -z $APP ]]; then
|
||||
echo "Please specify an app to run the command on" >&2 && exit 1
|
||||
else
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@@ -114,6 +119,7 @@ case "$1" in
|
||||
|
||||
config:set)
|
||||
parse_config_args "$@"
|
||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
@@ -166,6 +172,7 @@ ${var}"
|
||||
|
||||
config:unset)
|
||||
parse_config_args "$@"
|
||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
|
||||
|
||||
Reference in New Issue
Block a user