2022-04-16 01:29:10 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|
|
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
|
|
|
|
|
|
|
|
cmd-builder-lambda-set() {
|
|
|
|
|
declare desc="set or clear a builder-lambda property for an app"
|
|
|
|
|
declare cmd="builder-lambda:set"
|
|
|
|
|
[[ "$1" == "$cmd" ]] && shift 1
|
|
|
|
|
declare APP="$1" KEY="$2" VALUE="$3"
|
2022-04-17 02:08:48 -04:00
|
|
|
local VALID_KEYS=("lambdayml-path")
|
2022-04-16 01:29:10 -04:00
|
|
|
[[ "$APP" == "--global" ]] || verify_app_name "$APP"
|
|
|
|
|
|
|
|
|
|
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
|
|
|
|
|
|
|
|
|
|
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
|
2022-04-17 02:08:48 -04:00
|
|
|
dokku_log_fail "Invalid key specified, valid keys include: lambdayml-path"
|
2022-04-16 01:29:10 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ -n "$VALUE" ]]; then
|
|
|
|
|
dokku_log_info2_quiet "Setting ${KEY} to ${VALUE}"
|
|
|
|
|
fn-plugin-property-write "builder-lambda" "$APP" "$KEY" "$VALUE"
|
|
|
|
|
else
|
|
|
|
|
dokku_log_info2_quiet "Unsetting ${KEY}"
|
|
|
|
|
fn-plugin-property-delete "builder-lambda" "$APP" "$KEY"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cmd-builder-lambda-set "$@"
|