Files
dokku/plugins/config/commands
Jose Diaz-Gonzalez 70511c340d Check if command is implemented in a plugin before executing plugin code
Because of how plugin commands are implemented, their output can be incredibly verbose. Rather than executing even the `set -eo pipefail` parts of a plugin, we immediately check if the command is implemented by a plugin. If it is not, then we continue on as normal.

One side-effect of this change is that plugin commands need to be duplicated again:

- once in the command array
- once for the actual body of the command
- once in the help output

This is also quite hackish, and probably not the best way to decrease trace output. Note that we drop approximately 2k lines worth of logs with this change.
2015-09-18 16:09:59 -04:00

38 lines
902 B
Bash
Executable File

#!/usr/bin/env bash
[[ " config config:get config:set config:unset help config:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
case "$1" in
config)
config_all "$@"
;;
config:get)
config_get "$@"
;;
config:set)
config_set "$@"
;;
config:unset)
config_unset "$@"
;;
help | config:help)
cat<<EOF
config (<app>|--global), Display all global or app-specific config vars
config:get (<app>|--global) KEY, Display a global or app-specific config value
config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...], Set one or more config vars
config:unset (<app>|--global) KEY1 [KEY2 ...], Unset one or more config vars
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac