Skip to content

Commit deb858a

Browse files
authored
GUACAMOLE-374: Merge fix xmlstarlet syntax for RemoteIpValve attributes
2 parents 6493a23 + 7073a9c commit deb858a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

guacamole-docker/environment/REMOTE_IP_VALVE_/configure.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
## RemoteIpValve attributes that correspond to various "REMOTE_IP_VALVE_*"
3030
## environment variables.
3131
##
32-
declare -a VALVE_ATTRIBUTES=( --type attr -n className -v org.apache.catalina.valves.RemoteIpValve )
32+
declare -a VALVE_ATTRIBUTES=( --insert '/Server/Service/Engine/Host/Valve[not(@className)]' --type attr -n className -v org.apache.catalina.valves.RemoteIpValve )
3333

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

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

0 commit comments

Comments
 (0)