Skip to content

Commit

Permalink
Catch missing port in UDP output address
Browse files Browse the repository at this point in the history
  • Loading branch information
cmikk authored and reedjc committed Apr 17, 2023
1 parent c31c908 commit 55a80be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func parseConfig(args []string) (conf *Config, err error) {
fs.Var(&udpOutputAddr, "udp_output", "send NMSG UDP output to addr udp:<addr>:host")
fs.Parse(args)


conf = new(Config)
conf.StatsInterval.Set("15m")
conf.Heartbeat.Set("30s")
Expand Down Expand Up @@ -138,6 +137,9 @@ func parseConfig(args []string) (conf *Config, err error) {
if len(conf.Servers) == 0 && conf.UDPOutput.UDPAddr == nil {
err = errors.New("no servers or output specified")
}
if conf.UDPOutput.UDPAddr != nil && conf.UDPOutput.UDPAddr.Port == 0 {
err = errors.New("no UDP port specified")
}
if conf.DnstapInput == "" {
err = errors.New("no input specified")
}
Expand Down

0 comments on commit 55a80be

Please sign in to comment.