This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c81c469ec4 Fixed: docker-entrypoint.sh does not properly handle 
variable OFBIZ_DISABLE_COMPONENTS (OFBIZ-13314)
c81c469ec4 is described below

commit c81c469ec4307682e5a12ce811ce186af4b15abd
Author: Javier Ochoa <[email protected]>
AuthorDate: Fri Nov 14 14:28:14 2025 +0200

    Fixed: docker-entrypoint.sh does not properly handle variable 
OFBIZ_DISABLE_COMPONENTS (OFBIZ-13314)
    
    docker-entrypoint.sh did not properly handle variable
    OFBIZ_DISABLE_COMPONENTS, but it is fixed so that the variable can be
    accepted being a list of comma-separated values, and disable one after
    another.
    
    Thanks: Javier Ochoa
    
    Co-authored-by: javierAtRoukua 
<[email protected]>
---
 docker/docker-entrypoint.sh | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index baa1536c94..f6211e0d08 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -146,7 +146,7 @@ ofbiz_setup_env() {
   OFBIZ_POSTGRES_TENANT_USER=${OFBIZ_POSTGRES_TENANT_USER:-ofbiztenant}
   OFBIZ_POSTGRES_TENANT_PASSWORD=${OFBIZ_POSTGRES_TENANT_PASSWORD:-ofbiztenant}
 
-  
OFBIZ_DISABLE_COMPONENTS=${OFBIZ_DISABLE_COMPONENTS-plugins/birt/ofbiz-component.xml}
+  
OFBIZ_DISABLE_COMPONENTS=${OFBIZ_DISABLE_COMPONENTS:-plugins/birt/ofbiz-component.xml}
 }
 
 ###############################################################################
@@ -260,7 +260,6 @@ disable_component() {
   XML_FILE="/ofbiz/$1"
   if [ -f "$XML_FILE" ]; then
     TMPFILE=$(mktemp)
-
     xsltproc /ofbiz/disable-component.xslt "$XML_FILE" > "$TMPFILE"
     mv "$TMPFILE" "$XML_FILE"
   else
@@ -273,19 +272,24 @@ disable_component() {
 # components' 'enabled' attribute to false.
 # $1 - Comma separated list of paths to configuration XML files to be modified.
 disable_components() {
-  COMMA_SEPARATED_PATHS="$1"
+  COMMA_SEPARATED_PATHS=$1
 
-  if [ -n "$COMMA_SEPARATED_PATHS" ]; then
+  # Remove spaces after commas
+  COMMA_SEPARATED_PATHS="${COMMA_SEPARATED_PATHS//, /,}"
 
-    # Split the comma separated paths into separate arguments.
-    IFS=,
-    set "$COMMA_SEPARATED_PATHS"
+  [ -z "$COMMA_SEPARATED_PATHS" ] && return 0
 
-    while [ -n "$1" ]; do
-      disable_component "$1"
-      shift
-    done
-  fi
+  # Split on commas into $1 $2 ...
+  oldIFS=$IFS
+  IFS=,
+  set -- $COMMA_SEPARATED_PATHS    # <- no quotes, use -- to avoid option 
parsing
+  IFS=$oldIFS
+
+  # Iterate through the split arguments
+  while [ -n "$1" ]; do
+    disable_component "$1"
+    shift
+  done
 }
 
 ###############################################################################
@@ -316,7 +320,7 @@ apply_configuration() {
     fi
 
     if [ -n "$OFBIZ_DISABLE_COMPONENTS" ]; then
-      disable_component "$OFBIZ_DISABLE_COMPONENTS"
+      disable_components "$OFBIZ_DISABLE_COMPONENTS"
     fi
 
     touch "$CONTAINER_CONFIG_APPLIED"

Reply via email to