Skip to content

Commit

Permalink
get agent name from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
czeumer committed May 11, 2022
1 parent 209507d commit 102cced
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ossec/authd.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ func (c *EnrollmentConfig) SetLogger(logger *zap.Logger) {
}

func DefaultAgentName() (string, error) {
hostname, err := os.Hostname()
if err != nil {
return "", err
hostname := os.Getenv("WAZUH_AGENT_NAME")
if hostname == "" {
var err error
hostname, err = os.Hostname()
if err != nil {
return "", err
}
}
return hostname, nil
}
Expand Down

0 comments on commit 102cced

Please sign in to comment.