zentol commented on a change in pull request #12:
URL: https://github.com/apache/flink-docker/pull/12#discussion_r412851911



##########
File path: docker-entrypoint.sh
##########
@@ -96,29 +97,10 @@ elif [ "$1" = "taskmanager" ]; then
 
     
TASK_MANAGER_NUMBER_OF_TASK_SLOTS=${TASK_MANAGER_NUMBER_OF_TASK_SLOTS:-$(grep 
-c ^processor /proc/cpuinfo)}
 
-    if grep -E "^jobmanager\.rpc\.address:.*" "${CONF_FILE}" > /dev/null; then
-        sed -i -e "s/jobmanager\.rpc\.address:.*/jobmanager.rpc.address: 
${JOB_MANAGER_RPC_ADDRESS}/g" "${CONF_FILE}"
-    else
-        echo "jobmanager.rpc.address: ${JOB_MANAGER_RPC_ADDRESS}" >> 
"${CONF_FILE}"
-    fi
-
-    if grep -E "^taskmanager\.numberOfTaskSlots:.*" "${CONF_FILE}" > 
/dev/null; then
-        sed -i -e 
"s/taskmanager\.numberOfTaskSlots:.*/taskmanager.numberOfTaskSlots: 
${TASK_MANAGER_NUMBER_OF_TASK_SLOTS}/g" "${CONF_FILE}"
-    else
-        echo "taskmanager.numberOfTaskSlots: 
${TASK_MANAGER_NUMBER_OF_TASK_SLOTS}" >> "${CONF_FILE}"
-    fi
-
-    if grep -E "^blob\.server\.port:.*" "${CONF_FILE}" > /dev/null; then
-        sed -i -e "s/blob\.server\.port:.*/blob.server.port: 6124/g" 
"${CONF_FILE}"
-    else
-        echo "blob.server.port: 6124" >> "${CONF_FILE}"
-    fi
-
-    if grep -E "^query\.server\.port:.*" "${CONF_FILE}" > /dev/null; then
-        sed -i -e "s/query\.server\.port:.*/query.server.port: 6125/g" 
"${CONF_FILE}"
-    else
-        echo "query.server.port: 6125" >> "${CONF_FILE}"
-    fi
+    set_config_option jobmanager.rpc.address ${JOB_MANAGER_RPC_ADDRESS}
+    set_config_option taskmanager.numberOfTaskSlots 
${TASK_MANAGER_NUMBER_OF_TASK_SLOTS}
+    set_config_option blob.server.port 6124
+    set_config_option query.server.port 6125
 
     if [ -n "${FLINK_PROPERTIES}" ]; then
         echo "${FLINK_PROPERTIES}" >> "${CONF_FILE}"

Review comment:
       That is a separate issue. This PR is purely about de-duplicating code.




----------------------------------------------------------------
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.

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


Reply via email to