Skip to content

Commit

Permalink
GUACAMOLE-374: Merge fix xmlstarlet syntax for RemoteIpValve attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
necouchman committed Jul 30, 2024
2 parents 6493a23 + 7073a9c commit deb858a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions guacamole-docker/environment/REMOTE_IP_VALVE_/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
## RemoteIpValve attributes that correspond to various "REMOTE_IP_VALVE_*"
## environment variables.
##
declare -a VALVE_ATTRIBUTES=( --type attr -n className -v org.apache.catalina.valves.RemoteIpValve )
declare -a VALVE_ATTRIBUTES=( --insert '/Server/Service/Engine/Host/Valve[not(@className)]' --type attr -n className -v org.apache.catalina.valves.RemoteIpValve )

# Translate all properties supported by RemoteIpValve into corresponding
# environment variables
Expand All @@ -45,7 +45,7 @@ for ATTRIBUTE in \

VAR_NAME="REMOTE_IP_VALVE_$(echo "$ATTRIBUTE" | sed 's/\([a-z]\)\([A-Z]\)/\1_\2/g' | tr 'a-z' 'A-Z')"
if [ -n "${!VAR_NAME}" ]; then
VALVE_ATTRIBUTES+=( --type attr -n "$ATTRIBUTE" -v "${!VAR_NAME}" )
VALVE_ATTRIBUTES+=( --insert '/Server/Service/Engine/Host/Valve[@className="org.apache.catalina.valves.RemoteIpValve"]' --type attr -n "$ATTRIBUTE" -v "${!VAR_NAME}" )
else
echo "Using default RemoteIpValve value for \"$ATTRIBUTE\" attribute."
fi
Expand All @@ -55,7 +55,6 @@ done
# Programmatically add requested RemoteIpValve entry
xmlstarlet edit --inplace \
--insert '/Server/Service/Engine/Host/*' --type elem -n Valve \
--insert '/Server/Service/Engine/Host/Valve[not(@className)]' \
"${VALVE_ATTRIBUTES[@]}" \
"$CATALINA_BASE/conf/server.xml"

0 comments on commit deb858a

Please sign in to comment.