Skip to content
Closed
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
2 changes: 1 addition & 1 deletion cmd/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ dapr dashboard -k -p 9999
<-portForward.GetStop()
} else {
// Standalone mode
err := standalone.NewDashboardCmd(dashboardLocalPort).Run()
err := standalone.NewDashboardCmd(dashboardHost, dashboardLocalPort).Run()
if err != nil {
print.FailureStatusEvent(os.Stderr, "Dapr dashboard not found. Is Dapr installed?")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/standalone/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// NewDashboardCmd creates the command to run dashboard.
func NewDashboardCmd(port int) *exec.Cmd {
func NewDashboardCmd(address string, port int) *exec.Cmd {
// Use the default binary install location
dashboardPath := defaultDaprBinPath()
binaryName := "dashboard"
Expand All @@ -25,7 +25,7 @@ func NewDashboardCmd(port int) *exec.Cmd {
// Construct command to run dashboard
return &exec.Cmd{
Path: filepath.Join(dashboardPath, binaryName),
Args: []string{binaryName, "--port", strconv.Itoa(port)},
Args: []string{binaryName, "--address", address, "--port", strconv.Itoa(port)},
Dir: dashboardPath,
Stdout: os.Stdout,
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/standalone/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import (

func TestDashboardRun(t *testing.T) {
t.Run("build Cmd", func(t *testing.T) {
cmd := NewDashboardCmd(9090)
cmd := NewDashboardCmd("localhost", 9090)

assert.Contains(t, cmd.Args[0], "dashboard")
assert.Equal(t, cmd.Args[1], "--port")
assert.Equal(t, cmd.Args[2], "9090")
assert.Equal(t, cmd.Args[1], "--address")
assert.Equal(t, cmd.Args[2], "localhost")
assert.Equal(t, cmd.Args[3], "--port")
assert.Equal(t, cmd.Args[4], "9090")
})
}