Skip to content

Commit

Permalink
Merge pull request #5292 from dpandhi-git/master
Browse files Browse the repository at this point in the history
dashboard: When run as root, show URL instead of opening browser
  • Loading branch information
tstromberg authored Sep 10, 2019
2 parents 35cfb7e + 814c8e1 commit e589c37
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/minikube/cmd/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net/http"
"os"
"os/exec"
"os/user"
"regexp"
"time"

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

if dashboardURLMode {
//check if current user is root
user, err := user.Current()
if err != nil {
exit.WithError("Unable to get current user", err)
}
if dashboardURLMode || user.Uid == "0" {
out.Ln(url)
} else {
out.T(out.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url})
Expand Down

0 comments on commit e589c37

Please sign in to comment.