Skip to content

Commit 93cc631

Browse files
committed
[ni] fix create service 0-port when ServicePort option not set
1 parent 75e1835 commit 93cc631

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/agent/ni/service.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ import (
1818

1919
func (a *Agent) createService(tx pgx.Tx) error {
2020
log.Infof("Creating service record %s in database", config.Global.Agent.ServiceName)
21-
var servicePorts = []int{config.Global.Agent.ServicePort}
21+
var servicePorts []int
22+
if config.Global.Agent.ServicePort != 0 {
23+
servicePorts = append(servicePorts, config.Global.Agent.ServicePort)
24+
}
2225
for _, port := range config.Global.Agent.ServicePorts {
2326
if i, err := strconv.Atoi(port); err == nil {
2427
servicePorts = append(servicePorts, i)

0 commit comments

Comments
 (0)