Skip to content
This repository was archived by the owner on Jun 12, 2018. It is now read-only.

Commit 7139cf5

Browse files
author
Nicolas Huray
committed
Resolve EC2 IP running a Consul Agent through API
1 parent 46603cf commit 7139cf5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • consul/etc/services.d/consul-template

consul/etc/services.d/consul-template/run

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/usr/bin/with-contenv sh
22
set -e
33

4-
CONSUL_URL=${CONSUL_URL:-localhost:8500}
4+
if [ -n ${RUN_ON_AWS} ]; then
5+
# Resolve the EC2 IP running a Consul Agent through API
6+
CONSUL_URL=$(curl http://169.254.169.254/latest/meta-data/local-hostname)
7+
else
8+
CONSUL_URL=${CONSUL_URL:-localhost:8500}
9+
fi
510

611
if [ -d /etc/consul-template/conf ]; then
712
exec consul-template \

0 commit comments

Comments
 (0)