Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"io"
"log"
"net"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -114,14 +115,18 @@ func RunWebServer(port int, isDockerCompose bool, componentsPath string, configP
spa := spaHandler{staticPath: "web/dist", indexPath: "index.html"}
r.PathPrefix("/").Handler(spa)

listener, err := net.Listen("tcp", fmt.Sprintf("0.0.0.0:%v", port))
if err != nil {
log.Fatal(err)
}
port = listener.Addr().(*net.TCPAddr).Port
srv := &http.Server{
Handler: r,
Addr: fmt.Sprintf("0.0.0.0:%v", port),
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
fmt.Printf("Dapr Dashboard running on http://localhost:%v\n", port)
log.Fatal(srv.ListenAndServe())
log.Fatal(srv.Serve(listener))
}

// ServeHTTP inspects the URL path to locate a file within the static dir
Expand Down