From 0f9360f924b47fe6fce6f683a159bc184660a1ed Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 1 Sep 2022 13:57:02 -0400 Subject: [PATCH] defer to env for ZROK_API_ENDPOINT default (#47) --- cmd/zrok/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/zrok/main.go b/cmd/zrok/main.go index 64b21497..3b8ea00e 100644 --- a/cmd/zrok/main.go +++ b/cmd/zrok/main.go @@ -16,7 +16,11 @@ import ( func init() { pfxlog.GlobalInit(logrus.InfoLevel, pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti-test-kitchen/")) rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging") - rootCmd.PersistentFlags().StringVarP(&apiEndpoint, "endpoint", "e", "api.zrok.io", "zrok API endpoint address") + apiEndpointDefault := os.Getenv("ZROK_API_ENDPOINT") + if apiEndpoint == "" { + apiEndpoint = "api.zrok.io" + } + rootCmd.PersistentFlags().StringVarP(&apiEndpoint, "endpoint", "e", apiEndpointDefault, "zrok API endpoint address") rootCmd.AddCommand(httpCmd) }