diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index bcf01fa318..55e79f5d0d 100644 --- a/cmd/minikube/cmd/dashboard.go +++ b/cmd/minikube/cmd/dashboard.go @@ -19,6 +19,7 @@ package cmd import ( "fmt" "os" + "text/template" "time" "github.com/docker/machine/libmachine" @@ -53,7 +54,7 @@ var dashboardCmd = &cobra.Command{ os.Exit(1) } - urls, err := cluster.GetServiceURLsForService(api, namespace, service, nil) + urls, err := cluster.GetServiceURLsForService(api, namespace, service, template.Must(template.New("dashboardServiceFormat").Parse(defaultServiceFormatTemplate))) if err != nil { fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, "Check that minikube is running.") diff --git a/cmd/minikube/cmd/service.go b/cmd/minikube/cmd/service.go index 30d96678a4..897b221cdc 100644 --- a/cmd/minikube/cmd/service.go +++ b/cmd/minikube/cmd/service.go @@ -96,12 +96,14 @@ var serviceCmd = &cobra.Command{ }, } +const defaultServiceFormatTemplate = "http://{{.IP}}:{{.Port}}" + func init() { serviceCmd.Flags().StringVarP(&namespace, "namespace", "n", "default", "The service namespace") serviceCmd.Flags().BoolVar(&serviceURLMode, "url", false, "Display the kubernetes service URL in the CLI instead of opening it in the default browser") serviceCmd.Flags().BoolVar(&https, "https", false, "Open the service URL with https instead of http") - serviceCmd.PersistentFlags().StringVar(&serviceURLFormat, "format", "http://{{.IP}}:{{.Port}}", "Format to output service URL in. This format will be applied to each url individually and they will be printed one at a time.") + serviceCmd.PersistentFlags().StringVar(&serviceURLFormat, "format", defaultServiceFormatTemplate, "Format to output service URL in. This format will be applied to each url individually and they will be printed one at a time.") RootCmd.AddCommand(serviceCmd) }