#!/bin/sh

#   provide NOMAD_ADDR for connecting to nomad instance
bind_addr=`grep 'bind_addr *=' \
    @l_prefix@/etc/nomad/nomad.conf | \
    sed -e 's;^[^"]*";;' -e 's;".*$;;'`
port_http=`grep 'http *=' \
    @l_prefix@/etc/nomad/nomad.conf | \
    sed -e 's;^.*= *;;' -e 's; .*$;;'`
NOMAD_ADDR=http://${bind_addr}:${port_http}
export NOMAD_ADDR

#   pass-through execution
exec @l_prefix@/libexec/nomad/nomad ${1+"$@"}

