Skip to content

Commit

Permalink
pkg/hub: fix GetPort
Browse files Browse the repository at this point in the history
  • Loading branch information
navigaid committed Jan 2, 2025
1 parent ca65506 commit 8710f1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions pkg/hub/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ type Config struct {
Version *version.Version
}

func (c *Config) GetPort() string {
if c.Port != "" {
return c.Port
}
return utils.EnvPORT(k0s.HUB_PORT)
}

func Parse(args []string) *Config {
fset := flag.NewFlagSet("hub", flag.ExitOnError)
var (
Expand All @@ -43,7 +36,7 @@ func Parse(args []string) *Config {
showVersion bool
)

fset.StringVar(&port, "port", "", "hub listening port")
fset.StringVar(&port, "port", utils.EnvPORT(k0s.HUB_PORT), "hub listening port")
fset.StringVar(&cert, "cert", "", "path to tls cert file")
fset.StringVar(&key, "key", "", "path to tls key file")
fset.StringVar(&ufo, "ufo", "", "webteleport station")
Expand Down
2 changes: 1 addition & 1 deletion pkg/hub/server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func NewHub(c *config.Config) hub.Hub {
}
}()
// ensure core fields of h is not empty before return
h.setupServer(h.config.GetPort(), "/api", listhand)
h.setupServer(h.config.Port, "/api", listhand)
go h.serveLoop(listhand)
return h
}
Expand Down

0 comments on commit 8710f1d

Please sign in to comment.