Syphdias commented on code in PR #2791:
URL: https://github.com/apache/activemq/pull/2791#discussion_r4486110131


##########
assembly/src/docker/entrypoint.sh:
##########
@@ -26,20 +29,16 @@ if [ -n "${ACTIVEMQ_CONNECTION_USER}" ]; then
     echo "Enabling ActiveMQ Connection Security"
     sed -i 
"s/activemq.username=system/activemq.username=${ACTIVEMQ_CONNECTION_USER}/" 
${ACTIVEMQ_HOME}/conf/credentials.properties
     sed -i 
"s/activemq.password=manager/activemq.password=${ACTIVEMQ_CONNECTION_PASSWORD}/"
 ${ACTIVEMQ_HOME}/conf/credentials.properties
-    read -r -d '' REPLACE << END
+    IFS= read -r -d '' REPLACE <<"END" || true
       <plugins>
         <simpleAuthenticationPlugin>
           <users>
-            <authenticationUser username="$\{activemq.username}" 
password="$\{activemq.password}"/>
+            <authenticationUser username="${activemq.username}" 
password="${activemq.password}"/>
           </users>
         </simpleAuthenticationPlugin>
       </plugins>
-    </broker>
 END
-    REPLACE=${REPLACE//$\\/$}
-    REPLACE=${REPLACE//\//\\\/}
-    REPLACE=$(echo $REPLACE | tr '\n' ' ')
-    sed -i "s/<\/broker>/$REPLACE/" ${ACTIVEMQ_HOME}/conf/activemq.xml
+    sed -i "s,</broker>,${REPLACE//$'\n'/\\n}&," 
${ACTIVEMQ_HOME}/conf/activemq.xml

Review Comment:
   I love (g)awk, nothing against it. I just wanted to improve the situation to 
make is simpler with `<<"EOF"`.
   Your solutions does not retain same permission including owner, group, mode, 
acl. Absolutely, solvable though, not the point :)
   
   If there is interest for the PR in general, I can look into that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to