V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m57s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-10-24 22:29:00 +01:00
parent 5f6cf4f16d
commit d2598e40db

View File

@@ -161,21 +161,7 @@ yaml_secret() {
# -N : no "---" doc separators
# -0 : NUL between *each* result
# shellcheck disable=SC2016,SC2312
exec {__pipe_fd}< <(
yq -r -N -0 '
def emit($p; $v):
if ($v|type) == "object" then
($v | to_entries[] | emit(($p + (if $p=="" then "" else "." end) + .key); .value))
elif ($v|type) == "array" then
(range(0; ($v|length)) | emit(($p + "[" + (tostring) + "]"); $v[.]))
else
if ($p | endswith(".value")) then
($p | sub("\\.value$"; "")), (($v // "") | tostring)
else empty end
end;
(.secrets // empty) | emit("secrets"; .)
' -- "${secrets_yaml}"
)
exec {__pipe_fd}< <( yq -r -N -0 'path(..) as $p | select( $p[0] == "secrets" and $p[-1] == "value" and ((getpath($p) | type) != "object") and ((getpath($p) | type) != "array") ) | ($p[0:-1] | join(".")), ((getpath($p) // "") | tostring)' -- "${secrets_yaml}" )
fi