ctubbsii commented on a change in pull request #966: fluo-env.sh now supports
FLUO_JAVA_OPTS set in environment
URL: https://github.com/apache/fluo/pull/966#discussion_r149233571
##########
File path: modules/distribution/src/main/config/fluo-env.sh
##########
@@ -35,7 +35,12 @@ export
FLUO_CONN_PROPS="${FLUO_CONN_PROPS:-${conf}/fluo-conn.properties}"
## Fluo log4j configuration
export FLUO_LOG4J_CONFIG="${FLUO_LOG4J_CONFIG:-${conf}/log4j.properties}"
## Java options for Fluo command
-JAVA_OPTS=("-Dlog4j.configuration=file:${FLUO_LOG4J_CONFIG}")
+JAVA_OPTS="-Dlog4j.configuration=file:${FLUO_LOG4J_CONFIG}"
+##Prepending JAVA_OPTS with FLUO_JAVA_OPTS
+for var in "${FLUO_JAVA_OPTS[@]}"
+do
+ JAVA_OPTS=("$var $JAVA_OPTS")
Review comment:
You don't need to do the `for` loop, and you still need the elements
separately quoted.
If `FLUO_JAVA_OPTS` is an array, then all of this can become:
```bash
JAVA_OPTS=("${FLUO_JAVA_OPTS[@]}"
"-Dlog4j.configuration=file:${FLUO_LOG4J_CONFIG}")
```
If `FLUO_JAVA_OPTS` is a scalar, then it should look like:
```bash
JAVA_OPTS=(${FLUO_JAVA_OPTS}
"-Dlog4j.configuration=file:${FLUO_LOG4J_CONFIG}")
```
Personally, I prefer the former, but it does require users to know it's an
array, and to set it accordingly. If they do, then they are much better off,
because they don't need to deal with messy quote-escaping.
See http://wiki.bash-hackers.org/syntax/arrays for a decent write-up of bash
arrays, especially the section titled "Getting Values" which talks about how
quoted arrays are expanded, and the "Storing Values" section which shows how
elements are space-separated in array assignment. Just like elsewhere in bash,
quotes around spaces are a way of escaping that space... so: `x=("a b")` is an
array containing one element, and `x=("a" "b")` is an array containing two.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services