Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
config: fail start-up when hostname is empty (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbbr committed Sep 11, 2018
1 parent 2baa5f1 commit 556803c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (c *AgentConfig) Validate() error {
}
if c.Hostname == "" {
if err := c.acquireHostname(); err != nil {
return ErrMissingHostname
return err
}
}
return nil
Expand Down Expand Up @@ -207,6 +207,9 @@ func (c *AgentConfig) acquireHostname() error {
if err != nil || c.Hostname == "" {
c.Hostname, err = os.Hostname()
}
if c.Hostname == "" {
err = ErrMissingHostname
}
return err
}

Expand Down

0 comments on commit 556803c

Please sign in to comment.