2017-08-30 17:48:29 +03:00
|
|
|
EN=$(ifconfig en0 | grep "inet " | grep -oE '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' | head -n 1)
|
|
|
|
ETH=$(ifconfig eth0 | grep "inet " | grep -oE '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' | head -n 1)
|
2018-03-15 18:22:03 +03:00
|
|
|
INTERNAL_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
|
2017-08-30 17:48:29 +03:00
|
|
|
|
2018-03-15 18:22:03 +03:00
|
|
|
if test -n "$EN"; then
|
|
|
|
DOCKER_KAFKA_HOST=$EN
|
|
|
|
elif test -n "$ETH"; then
|
2017-08-30 17:48:29 +03:00
|
|
|
DOCKER_KAFKA_HOST=$ETH
|
|
|
|
else
|
2018-03-15 18:22:03 +03:00
|
|
|
DOCKER_KAFKA_HOST=$INTERNAL_IP
|
2017-08-30 17:48:29 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo $DOCKER_KAFKA_HOST
|