Files
dokku/plugins/config/functions

51 lines
1023 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
2017-02-18 15:56:31 -05:00
config_sub(){
declare desc="executes a config subcommand"
local name="$1"
shift
"$PLUGIN_AVAILABLE_PATH/config/subcommands/$name" "config:$name" "$@"
}
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_keys() {
declare desc="returns keys for app or global"
2017-05-20 14:38:27 -04:00
config_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_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() {
declare desc="set 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 "$@"
}