builder-nixpacks/internal-functions

46 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2022-08-30 10:26:44 -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-nixpacks-report() {
declare desc="displays a builder-nixpacks report for one or more apps"
declare cmd="builder-nixpacks:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi
if [[ -z "$APP" ]]; then
for app in $(dokku_apps); do
cmd-builder-nixpacks-report-single "$app" "$INFO_FLAG" | tee || true
done
else
cmd-builder-nixpacks-report-single "$APP" "$INFO_FLAG"
fi
}
cmd-builder-nixpacks-report-single() {
declare APP="$1" INFO_FLAG="$2"
verify_app_name "$APP"
2022-08-30 10:50:04 -04:00
dokku_log_info2_quiet "${APP} builder-nixpacks information"
local NIXPACK_KEYS="$(fn-builder-nixpacks-valid-keys)"
2022-08-30 11:27:56 -04:00
for key in $NIXPACK_KEYS ; do
2022-08-30 10:50:04 -04:00
local result="$(fn-plugin-property-get "builder-nixpacks" "$APP" "$key")"
dokku_log_verbose "$(printf "%-30s %-40s" "${key}" "${result}")"
done
2022-08-30 10:26:44 -04:00
}
2022-08-30 10:50:04 -04:00
fn-builder-nixpacks-valid-keys() {
2022-08-30 11:45:12 -04:00
echo "build-cmd cache-key env install-cmd libs pkgs start-cmd"
2022-08-30 11:27:56 -04:00
}