Skip to content

Commit

Permalink
fix: print correct warning based on OS
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan committed Jul 21, 2022
1 parent 4da67f8 commit 0e5b72b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions bin/vproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"regexp"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -214,7 +215,7 @@ func createCAROOT() error {
fmt.Printf("creating new CA at %s\n", path)
}

fmt.Printf("\n >> NOTE: you may be prompted to enter your sudo password <<\n\n")
warnPW()

err := os.MkdirAll(path, 0755)
if err != nil {
Expand All @@ -235,6 +236,14 @@ func createCAROOT() error {
return nil
}

func warnPW() {
sudo := "sudo"
if runtime.GOOS == "windows" {
sudo = "admin"
}
fmt.Printf("\n >> NOTE: you may be prompted to enter your %s password <<\n\n", sudo)
}

func uninstallCAROOT() error {
path := vproxy.CARootPath()
os.Setenv("CAROOT", path)
Expand All @@ -244,7 +253,7 @@ func uninstallCAROOT() error {
return nil
}

fmt.Printf("\n >> NOTE: you may be prompted to enter your sudo password <<\n\n")
warnPW()

truststore.Print = true
err := vproxy.InitTrustStore()
Expand Down

0 comments on commit 0e5b72b

Please sign in to comment.