|
|
@ -458,9 +458,49 @@ EOF |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_get_custom_rules() { |
|
|
|
local custom_rules type elt value first |
|
|
|
custom_rules=$(relation-get apache-custom-rules 2>/dev/null) || true |
|
|
|
if [ -z "$custom_rules" ]; then |
|
|
|
return 0 |
|
|
|
fi |
|
|
|
type=$(echo "$custom_rules" | shyaml get-type) |
|
|
|
value= |
|
|
|
case "$type" in |
|
|
|
"sequence") |
|
|
|
first=1 |
|
|
|
while read-0 elt; do |
|
|
|
elt="$(echo "$elt" | yaml_get_interpret)" || return 1 |
|
|
|
[ "$elt" ] || continue |
|
|
|
if [ "$first" ]; then |
|
|
|
first= |
|
|
|
else |
|
|
|
value+=$'\n'$'\n' |
|
|
|
fi |
|
|
|
first= |
|
|
|
value+="$elt" |
|
|
|
done < <(echo "$custom_rules" | shyaml -y get-values-0) |
|
|
|
;; |
|
|
|
"struct") |
|
|
|
while read-0 _key val; do |
|
|
|
value+=$'\n'"$(echo "$val" | yaml_get_interpret)" || return 1 |
|
|
|
done < <(echo "$custom_rules" | shyaml -y key-values-0) |
|
|
|
;; |
|
|
|
"str") |
|
|
|
value+=$(echo "$custom_rules") |
|
|
|
;; |
|
|
|
*) |
|
|
|
value+=$(echo "$custom_rules") |
|
|
|
;; |
|
|
|
esac |
|
|
|
printf "%s" "$value" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
__vhost_custom_rules() { |
|
|
|
local custom_rules |
|
|
|
if custom_rules=$(relation-get apache-custom-rules 2>/dev/null); then |
|
|
|
custom_rules=$(_get_custom_rules) || return 1 |
|
|
|
if [ "$custom_rules" ]; then |
|
|
|
cat <<EOF |
|
|
|
|
|
|
|
|
|
|
|