mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 12:07:45 +01:00
This MR splits out the logic such that there is now a binary that handles function based calls without validating the app name. We should only every check the app name for the subcommands and not internally. Internal calls should have their arguments taken at face value.
68 lines
1.3 KiB
Bash
Executable File
68 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
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/config_sub" "$name" "$@"
|
|
}
|
|
|
|
config_export() {
|
|
declare desc="returns export command for config variable of specified type (app/global)"
|
|
local CONFIG_TYPE="$1"
|
|
shift
|
|
local APP="$1"
|
|
if [[ $CONFIG_TYPE == "global" ]]; then
|
|
APP="--global"
|
|
else
|
|
shift
|
|
fi
|
|
config_sub export "$@" "$APP"
|
|
return 0
|
|
}
|
|
|
|
config_all() {
|
|
declare desc="Backwards compatible function for plugin use"
|
|
[[ "$1" == "config" ]] || set -- "config" "$@"
|
|
if [[ -n "$DOKKU_CONFIG_EXPORT" ]]; then
|
|
config_export app "$@"
|
|
return 0
|
|
fi
|
|
|
|
"$PLUGIN_AVAILABLE_PATH/config/subcommands/show" "$@"
|
|
}
|
|
|
|
config_keys() {
|
|
declare desc="returns keys for app or global"
|
|
config_sub keys "$@"
|
|
return 0
|
|
}
|
|
|
|
config_get() {
|
|
declare desc="get value of given config var"
|
|
config_sub get "$@"
|
|
}
|
|
|
|
config_clear() {
|
|
declare desc="clears config vars"
|
|
config_sub clear "$@"
|
|
}
|
|
|
|
config_set() {
|
|
declare desc="set value of given config var"
|
|
config_sub set "$@"
|
|
}
|
|
|
|
config_unset() {
|
|
declare desc="unset value of given config var"
|
|
config_sub unset "$@"
|
|
}
|
|
|
|
config_bundle() {
|
|
declare desc="export tar bundle of config"
|
|
config_sub bundle "$@"
|
|
}
|