Fix endpoint URL formatting to handle default port correctly
This commit is contained in:
parent
6b6edab97c
commit
1d414bceb8
2 changed files with 6 additions and 2 deletions
|
|
@ -148,7 +148,7 @@ var startCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
root, _ := adminRoot()
|
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 {
|
switch host {
|
||||||
case "0.0.0.0":
|
case "0.0.0.0":
|
||||||
// All interfaces
|
// All interfaces
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,12 @@ func Endpoints(cfg config.Config) ([]Endpoint, error) {
|
||||||
|
|
||||||
var endpoints []Endpoint
|
var endpoints []Endpoint
|
||||||
for _, network := range networks {
|
for _, network := range networks {
|
||||||
|
port := fmt.Sprintf(":%d", cfg.Port)
|
||||||
|
if port == ":80" {
|
||||||
|
port = ""
|
||||||
|
}
|
||||||
endpoint := Endpoint{
|
endpoint := Endpoint{
|
||||||
URL: fmt.Sprintf("http://%s:%d", network.IPv4, cfg.Port),
|
URL: fmt.Sprintf("http://%s%s", network.IPv4, port),
|
||||||
Interface: network.Interface,
|
Interface: network.Interface,
|
||||||
}
|
}
|
||||||
endpoints = append(endpoints, endpoint)
|
endpoints = append(endpoints, endpoint)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue