feat: avoid calling the user-auth trigger where possible

As this trigger is always in the execution path, `plugn` starts and expensively checks to see if it can execute the trigger. Rather than call this on every invocation, skip the trigger if no non-core implementation exists.
This commit is contained in:
Jose Diaz-Gonzalez
2019-08-01 20:18:14 -04:00
parent ba5b5d4596
commit 5b53994447

View File

@@ -672,6 +672,12 @@ dokku_auth() {
declare desc="calls user-auth plugin trigger"
export SSH_USER=${SSH_USER:=$USER}
export SSH_NAME=${NAME:="default"}
# this plugin trigger exists in the core `20_events` plugin
if [[ $(find "$PLUGIN_PATH"/enabled/*/user-auth 2>/dev/null | wc -l) == 1 ]]; then
return 0
fi
if ! plugn trigger user-auth "$SSH_USER" "$SSH_NAME" "$@"; then
return 1
fi