builder-nixpacks/internal-functions

46 lines
1.4 KiB
Plaintext
Raw 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)"
for key in "${NIXPACK_KEYS[@]}" ; do
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() {
echo "NIXPACKS_APT_PKGS NIXPACKS_BUILD_CACHE_DIRS NIXPACKS_BUILD_CMD NIXPACKS_INSTALL_CACHE_DIRS NIXPACKS_INSTALL_CMD NIXPACKS_LIBS NIXPACKS_NO_CACHE NIXPACKS_NO_MUSL NIXPACKS_PKGS NIXPACKS_START_CMD"
)