Skip to content

Commit

Permalink
fix(server): add check for port (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3r authored Jan 13, 2021
1 parent a4f8edf commit 60a7ed0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/vela-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,15 @@ func server(c *cli.Context) error {
var tomb tomb.Tomb
// start http server
tomb.Go(func() error {
port := addr.Port()

// check if a port is part of the address
if len(port) == 0 {
port = "8080"
}

// gin expects the address to be ":<port>" ie ":8080"
srv := &http.Server{Addr: fmt.Sprintf(":%s", addr.Port()), Handler: router}
srv := &http.Server{Addr: fmt.Sprintf(":%s", port), Handler: router}

logrus.Infof("running server on %s", addr.Host)
go func() {
Expand Down

0 comments on commit 60a7ed0

Please sign in to comment.