zhuzhurk commented on code in PR #24194:
URL: https://github.com/apache/flink/pull/24194#discussion_r1466072601
##########
flink-dist/src/main/flink-bin/bin/config-parser-utils.sh:
##########
@@ -23,6 +23,42 @@ if [ "$#" -lt 3 ]; then
echo "$USAGE"
exit 1
fi
+
+readFromConfigFile() {
+ local key=$1
+ local defaultValue=$2
+ local configFile=$3
+
+ # first extract the value with the given key (1st sed), then trim the
result (2nd sed)
+ # if a key exists multiple times, take the "last" one (tail)
+ local value=`sed -n "s/^[ ]*${key}[ ]*: \([^#]*\).*$/\1/p" "${configFile}"
| sed "s/^ *//;s/ *$//" | tail -n 1`
+
+ [ -z "$value" ] && echo "$defaultValue" || echo "$value"
+}
+
+# read JAVA_HOME from config with no default value
Review Comment:
Can we extract it to a method `setJavaHome` to be reused by config.sh?
--
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]