diff --git a/images/broker/alpine/brokerGenConfig.sh b/images/broker/alpine/brokerGenConfig.sh index 033dda75..f63ec224 100755 --- a/images/broker/alpine/brokerGenConfig.sh +++ b/images/broker/alpine/brokerGenConfig.sh @@ -27,7 +27,10 @@ function create_config() { echo "brokerClusterName=$BROKER_CLUSTER_NAME" >> $BROKER_CONFIG_FILE echo "brokerName=$BROKER_NAME" >> $BROKER_CONFIG_FILE echo "brokerId=$BROKER_ID" >> $BROKER_CONFIG_FILE - echo "brokerIP1=`hostname -i`" >> $BROKER_CONFIG_FILE + + BROKER_NETWORK_DEV=`/sbin/route |awk '/^default/{print $NF}'` + BROKER_IP=`ip a s ${BROKER_NETWORK_DEV} |awk -F' +|/' '/ inet /{print $3}'` + echo "brokerIP1=${BROKER_IP}" >> $BROKER_CONFIG_FILE if [ $BROKER_ID != 0 ]; then sed -i 's/brokerRole=.*/brokerRole=SLAVE/g' $BROKER_CONFIG_FILE fi