main
Andrew Coleman 2022-08-30 10:50:04 -04:00
parent 13dd515aee
commit 97eb7582a0
2 changed files with 12 additions and 29 deletions

View File

@ -30,35 +30,16 @@ cmd-builder-nixpacks-report() {
cmd-builder-nixpacks-report-single() {
declare APP="$1" INFO_FLAG="$2"
if [[ "$INFO_FLAG" == "true" ]]; then
INFO_FLAG=""
fi
verify_app_name "$APP"
local flag_map=$(fn-plugin-property-get-all "builder-nixpacks" "$APP")
if [[ -z "$INFO_FLAG" ]]; then
dokku_log_info2_quiet "${APP} builder-nixpacks information"
for flag in "${flag_map[@]}"; do
key="$(echo "${flag#--}" | cut -f1 -d' ')"
dokku_log_verbose "$(printf "%-30s %-25s" "${key^}" "${flag#* }")"
done
else
local match=false
local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d' ' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
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
}
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"
)

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/builder-nixpacks/internal-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
@ -9,6 +10,7 @@ cmd-builder-nixpacks-set() {
declare cmd="builder-nixpacks:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=$(fn-builder-nixpacks-valid-keys)
local VALID_KEYS=(\
"NIXPACKS_APT_PKGS" \
"NIXPACKS_BUILD_CACHE_DIRS" \