Skip to content
Snippets Groups Projects
Commit 1b770307 authored by Jan Christophersen's avatar Jan Christophersen
Browse files

Bail early if metrics server address is empty

parent ac0d335e
No related branches found
No related tags found
No related merge requests found
......@@ -80,12 +80,16 @@ func (c *configOptionsWithMetricsServer) metricsServerAddress() (string, error)
address = c.MetricsServerAddress
}
if address == "" {
return "", nil
}
_, port, err := net.SplitHostPort(address)
if err != nil && !strings.Contains(err.Error(), "missing port in address") {
return "", err
}
if len(address) > 0 && len(port) == 0 {
if len(port) == 0 {
return fmt.Sprintf("%s:%d", address, common.DefaultMetricsServerPort), nil
}
return address, nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment