refactor: rename computed-* helpers, expose computed vector and network keys
Addresses review feedback on #8640. fn-archive-max-size, fn-archive-max-files, fn-git-deploy-branch, and fn-git-keep-git-dir are renamed with `computed` in the function name so the names match the resolved-with-default semantic they implement, and every caller is updated in lockstep. logs:report renames the misordered --logs-vector-global-image and --logs-vector-global-networks to --logs-global-vector-image and --logs-global-vector-networks, makes the global getters return the raw stored value, and adds --logs-computed-vector-image, --logs-computed-vector-networks, and --logs-computed-vector-sink. network:report --global gains the computed-* keys for attach-post-create, attach-post-deploy, initial-network, and tld so external tooling can read the resolved value at global scope. The --quiet flag is dropped from every :report --format json | jq invocation across the PR's bats files; the report's --format json output is the only stdout and the flag is redundant.
This commit is contained in:
@@ -11,12 +11,12 @@ fi
|
||||
DOKKU_ARCHIVE_MAX_SIZE_DEFAULT="1073741824"
|
||||
DOKKU_ARCHIVE_MAX_FILES_DEFAULT="10000"
|
||||
|
||||
fn-archive-max-size() {
|
||||
fn-archive-computed-max-size() {
|
||||
declare desc="returns the configured max archive size in bytes"
|
||||
fn-plugin-property-get "git" "--global" "archive-max-size" "$DOKKU_ARCHIVE_MAX_SIZE_DEFAULT"
|
||||
}
|
||||
|
||||
fn-archive-max-files() {
|
||||
fn-archive-computed-max-files() {
|
||||
declare desc="returns the configured max archive entry count"
|
||||
fn-plugin-property-get "git" "--global" "archive-max-files" "$DOKKU_ARCHIVE_MAX_FILES_DEFAULT"
|
||||
}
|
||||
@@ -43,8 +43,8 @@ fn-archive-check-bomb-protection() {
|
||||
declare desc="validates archive against bomb protection limits"
|
||||
declare ARCHIVE_PATH="$1" ARCHIVE_TYPE="$2"
|
||||
local MAX_SIZE MAX_FILES
|
||||
MAX_SIZE="$(fn-archive-max-size)"
|
||||
MAX_FILES="$(fn-archive-max-files)"
|
||||
MAX_SIZE="$(fn-archive-computed-max-size)"
|
||||
MAX_FILES="$(fn-archive-computed-max-files)"
|
||||
|
||||
local ARCHIVE_SIZE
|
||||
ARCHIVE_SIZE="$(stat -c %s "$ARCHIVE_PATH" 2>/dev/null || stat -f %z "$ARCHIVE_PATH" 2>/dev/null || echo 0)"
|
||||
@@ -190,8 +190,8 @@ fn-archive-extract-zip() {
|
||||
declare desc="safely extracts a zip archive with post-extraction symlink validation"
|
||||
declare ARCHIVE_PATH="$1" DEST_DIR="$2"
|
||||
local MAX_SIZE MAX_FILES
|
||||
MAX_SIZE="$(fn-archive-max-size)"
|
||||
MAX_FILES="$(fn-archive-max-files)"
|
||||
MAX_SIZE="$(fn-archive-computed-max-size)"
|
||||
MAX_FILES="$(fn-archive-computed-max-files)"
|
||||
|
||||
local ARCHIVE_SIZE
|
||||
ARCHIVE_SIZE="$(stat -c %s "$ARCHIVE_PATH" 2>/dev/null || stat -f %z "$ARCHIVE_PATH" 2>/dev/null || echo 0)"
|
||||
|
||||
Reference in New Issue
Block a user