diff --git a/elnginx.go b/elnginx.go index 24fa68e..47156ec 100644 --- a/elnginx.go +++ b/elnginx.go @@ -46,7 +46,7 @@ func addInstance(u config.Upstream, i *ec2.Instance) error { u.Lock() defer u.Unlock() - upstream := fmt.Sprintf("server %s:80 max_fails=3 fail_timeout=60s;\n", i.PrivateDNSName) + upstream := fmt.Sprintf("server %s:80 max_fails=3 fail_timeout=60s; # %s\n", i.PrivateDNSName, i.InstanceId) buf := []byte(upstream) if err := ioutil.WriteFile(filename, buf, 0640); err != nil { diff --git a/elnginx_test.go b/elnginx_test.go index 43ad127..6e00ef5 100644 --- a/elnginx_test.go +++ b/elnginx_test.go @@ -110,7 +110,7 @@ func (s *S) TestReadMessageWithLaunchJSON(c *gocheck.C) { upstream := Config.Upstreams[0] content, err := ioutil.ReadFile(upstream.File) c.Assert(err, gocheck.IsNil) - serverLine := fmt.Sprintf("server %s.internal.invalid:80 max_fails=3 fail_timeout=60s;\n", s.instance_ids[0]) + serverLine := fmt.Sprintf("server %s.internal.invalid:80 max_fails=3 fail_timeout=60s; # %s\n", s.instance_ids[0], s.instance_ids[0]) c.Assert(string(content), gocheck.Equals, fmt.Sprintf("upstream %s {\n %s}\n", upstream.Name, serverLine)) // Check run NGINX reload @@ -125,7 +125,7 @@ func (s *S) TestAddInstance(c *gocheck.C) { content, err := ioutil.ReadFile(getUpstreamFilenameForInstance(u, i)) c.Assert(err, gocheck.IsNil) - c.Assert(string(content), gocheck.Equals, "server test.internal:80 max_fails=3 fail_timeout=60s;\n") + c.Assert(string(content), gocheck.Equals, "server test.internal:80 max_fails=3 fail_timeout=60s; # i-00000\n") } func (s *S) TestReadMessageWithTerminateJSON(c *gocheck.C) {