
# configure advertise_addr
iface=$(ip link | grep -v docker -A1 | grep -v lo -A1 | head -n1 | cut -f2 -d: | tr -d '[:space:]')
ip_addr=$(ip addr | grep ${iface} | grep -oP 'inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' | cut -f2 -d" ")
echo "advertise_addr = \"${ip_addr}\"" >> /etc/consul.d/server.hcl

