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

config: fail start-up when hostname is empty #470

Merged
merged 2 commits into from
Sep 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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