Skip to content

Commit

Permalink
Merge pull request #799 from trheyi/main
Browse files Browse the repository at this point in the history
Fix endpoint URL formatting to handle default port correctly
  • Loading branch information
trheyi authored Nov 29, 2024
2 parents 90b8760 + 1d414bc commit 2f88e5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ var startCmd = &cobra.Command{
}

root, _ := adminRoot()
endpoints := []setup.Endpoint{{URL: fmt.Sprintf("http://%s:%s", "127.0.0.1", port), Interface: "localhost"}}
endpoints := []setup.Endpoint{{URL: fmt.Sprintf("http://%s%s", "127.0.0.1", port), Interface: "localhost"}}
switch host {
case "0.0.0.0":
// All interfaces
Expand Down
6 changes: 5 additions & 1 deletion setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ func Endpoints(cfg config.Config) ([]Endpoint, error) {

var endpoints []Endpoint
for _, network := range networks {
port := fmt.Sprintf(":%d", cfg.Port)
if port == ":80" {
port = ""
}
endpoint := Endpoint{
URL: fmt.Sprintf("http://%s:%d", network.IPv4, cfg.Port),
URL: fmt.Sprintf("http://%s%s", network.IPv4, port),
Interface: network.Interface,
}
endpoints = append(endpoints, endpoint)
Expand Down

0 comments on commit 2f88e5c

Please sign in to comment.