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

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-10-26 16:05:01 +00:00
parent a5282fa305
commit 54e72c014b

View File

@@ -190,17 +190,20 @@ yaml_secret() {
yq -o=shell "${secrets_if}" >| "${__SECRETS}" && ciss_secrets_wiper "${secrets_if}"
sed -i -E '
/^[[:space:]]*(#|$)/b # Skip empty/comment lines.
s/^[[:space:]]*export[[:space:]]+// # Drop optional leading "export ".
/^[[:space:]]*[A-Za-z_][A-Za-z0-9_]*_value=/!b # Keep only *_value= assignments.
### Keep only '*_value=' lines, normalize empty RHS, quote unquoted simple RHS.
LC_ALL=C sed -n -E '
/^[[:space:]]*(#|$)/b
s/^[[:space:]]*(export|declare[[:space:]]+-x)[[:space:]]+//;
/^[[:space:]]*[A-Za-z_][A-Za-z0-9_]*_value=/!b
# --- Empty-value normalisation ---------------------------------------
s/^(.*)=\s*$/\1=""/ # turn key= into key=""
s/^([[:space:]]*[A-Za-z_][A-Za-z0-9_]*_value)=[[:space:]]*$/\1='\'''\''/; t print
/^[[:space:]]*[A-Za-z_][A-Za-z0-9_]*_value=[[:space:]]*('"'"'|\"|\$'"'"')/b print
s/^([[:space:]]*[A-Za-z_][A-Za-z0-9_]*_value)=([^[[:space:]]'"'"'$][^[:space:]]*)[[:space:]]*$/\1='"'"'\2'"'"'/; t print
:print
p
' -- "${__SECRETS}" >| "${__SECRETS}.value_only"
# --- Quote unquoted values -------------------------------------------
s/^(.*)=([^'\''"]+)/\1='\''\2'\''/ # wrap value in single quotes
' "${__SECRETS}"
mv -f -- "${__SECRETS}.value_only" "${__SECRETS}"
# shellcheck disable=SC1091 source=./${__SECRETS}
source "${__SECRETS}"