Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion cmd/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// RunDashboard runs the dashboard with the supplied flags
func RunDashboard() {
dashboardVersion := flag.Bool("version", false, "Prints the dashboard version")
address := flag.String("address", "localhost", "Address to listen on. Only accepts IP address or localhost as a value")
port := flag.Int("port", 8080, "Port to listen to")

flag.Parse()
Expand All @@ -19,6 +20,6 @@ func RunDashboard() {
fmt.Println(version.GetVersion())
os.Exit(0)
} else {
RunWebServer(*port)
RunWebServer(*address, *port)
}
}
6 changes: 3 additions & 3 deletions cmd/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var comps components.Components
var configs configurations.Configurations

// RunWebServer starts the web server that serves the Dapr UI dashboard and the API
func RunWebServer(port int) {
func RunWebServer(address string, port int) {
platform := ""
kubeClient, daprClient, _ := kube.Clients()
if kubeClient != nil {
Expand Down Expand Up @@ -94,11 +94,11 @@ func RunWebServer(port int) {

srv := &http.Server{
Handler: r,
Addr: fmt.Sprintf("0.0.0.0:%v", port),
Addr: fmt.Sprintf("%v:%v", address, port),
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
fmt.Printf("Dapr Dashboard running on http://localhost:%v\n", port)
fmt.Printf("Dapr Dashboard running on http://%v:%v\n", address, port)
log.Fatal(srv.ListenAndServe())
}

Expand Down