mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 11:03:59 +00:00
check_kerberos.sh (already updated) sourced knoe_env.sh, knoe_secrets.sh, knoe_string.sh, and knoe_yaml.sh but the files were still named prole_*.sh. No other script referenced the old names, so this is a pure rename. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
973 B
Bash
40 lines
973 B
Bash
#!/usr/bin/env bash
|
|
|
|
knoe_is_openbao_ref() {
|
|
local v="${1:-}"
|
|
[[ "$v" == '${OPENBAO:'* ]]
|
|
}
|
|
|
|
knoe_is_knoe_secret_ref() {
|
|
local v="${1:-}"
|
|
[[ "$v" == '${KNOE_SECRET:'* ]]
|
|
}
|
|
|
|
knoe_is_secret_ref() {
|
|
local v="${1:-}"
|
|
knoe_is_openbao_ref "$v" || knoe_is_knoe_secret_ref "$v"
|
|
}
|
|
|
|
# Returns 0 when the current value is empty or is a secret reference and therefore
|
|
# should be resolved from the configured secret backend.
|
|
knoe_secret_needs_resolution() {
|
|
local current="${1:-}"
|
|
[[ -z "$current" ]] || knoe_is_secret_ref "$current"
|
|
}
|
|
|
|
# Pure precedence helper:
|
|
# - If current value is a literal non-empty value, keep it.
|
|
# - If current is empty or a secret ref, prefer a non-empty fetched value.
|
|
knoe_secret_choose_value() {
|
|
local current="${1:-}"
|
|
local fetched="${2:-}"
|
|
|
|
if knoe_secret_needs_resolution "$current"; then
|
|
if [[ -n "$fetched" && "$fetched" != "null" ]]; then
|
|
printf '%s' "$fetched"
|
|
return 0
|
|
fi
|
|
fi
|
|
printf '%s' "$current"
|
|
}
|