Skip to content

Commit 61e2234

Browse files
committed
fix in dashboard.go to display dashborad url with root
1 parent e974ce3 commit 61e2234

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/minikube/cmd/dashboard.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"net/http"
2424
"os"
2525
"os/exec"
26+
"os/user"
2627
"regexp"
2728
"time"
2829

@@ -128,7 +129,12 @@ var dashboardCmd = &cobra.Command{
128129
exit.WithCodeT(exit.Unavailable, "{{.url}} is not accessible: {{.error}}", out.V{"url": url, "error": err})
129130
}
130131

131-
if dashboardURLMode {
132+
//check if current user is root
133+
user, err := user.Current()
134+
if err != nil {
135+
exit.WithError("Unable to get current user", err)
136+
}
137+
if dashboardURLMode && user.Uid == "0" {
132138
out.Ln(url)
133139
} else {
134140
out.T(out.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url})

0 commit comments

Comments
 (0)