Files
dokku/plugins/config/functions

68 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
config_sub() {
2017-02-18 15:56:31 -05:00
declare desc="executes a config subcommand"
local name="$1"
shift
"$PLUGIN_AVAILABLE_PATH/config/config_sub" "$name" "$@"
2017-02-18 15:56:31 -05:00
}
config_export() {
2016-03-08 15:30:34 -05:00
declare desc="returns export command for config variable of specified type (app/global)"
local CONFIG_TYPE="$1"
2017-02-18 15:56:31 -05:00
shift
local APP="$1"
if [[ $CONFIG_TYPE == "global" ]]; then
APP="--global"
2017-02-18 15:56:31 -05:00
else
shift
fi
2017-02-18 15:56:31 -05:00
config_sub export "$@" "$APP"
return 0
2015-09-01 14:30:32 -04:00
}
config_all() {
declare desc="Backwards compatible function for plugin use"
[[ "$1" == "config" ]] || set -- "config" "$@"
2017-12-13 17:17:10 -05:00
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"
2017-11-03 12:42:00 +09:00
config_sub keys "$@"
return 0
}
config_get() {
2016-03-08 15:30:34 -05:00
declare desc="get value of given config var"
2017-02-18 15:56:31 -05:00
config_sub get "$@"
}
config_clear() {
declare desc="clears config vars"
config_sub clear "$@"
}
config_set() {
2016-03-08 15:30:34 -05:00
declare desc="set value of given config var"
2017-02-18 15:56:31 -05:00
config_sub set "$@"
}
2015-09-01 14:30:32 -04:00
config_unset() {
2017-11-03 12:42:00 +09:00
declare desc="unset value of given config var"
2017-02-18 15:56:31 -05:00
config_sub unset "$@"
2015-09-01 14:30:32 -04:00
}
2017-05-20 14:38:27 -04:00
config_bundle() {
declare desc="export tar bundle of config"
config_sub bundle "$@"
}