Skip to content

Commit 9daab6f

Browse files
authored
Merge pull request #70 from onepanelio/feat/onepanelio.532-hosts.file
feat: display correct hosts file path on windows 10
2 parents e3ebf04 + 8661201 commit 9daab6f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

util/kubectl.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"k8s.io/kubectl/pkg/cmd/get"
1414
cmdutil "k8s.io/kubectl/pkg/cmd/util"
1515
"os"
16+
"runtime"
1617
"strconv"
1718
)
1819

@@ -188,7 +189,13 @@ func GetClusterIp(url string) {
188189
provider := yamlFile.GetValue("application.provider").Value
189190
if provider == "minikube" || provider == "microk8s" {
190191
fqdn := yamlFile.GetValue("application.fqdn").Value
191-
fmt.Printf("\nIn your /etc/hosts file, add %v and point it to %v\n", stdout, fqdn)
192+
193+
hostsPath := "/etc/hosts"
194+
if runtime.GOOS == "windows" {
195+
hostsPath = "C:\\Windows\\System32\\Drivers\\etc\\hosts"
196+
}
197+
198+
fmt.Printf("\nIn your %v file, add %v and point it to %v\n", hostsPath, stdout, fqdn)
192199
} else {
193200
dnsRecordMessage = "an A"
194201
if !IsIpv4(stdout) {

0 commit comments

Comments
 (0)