defer to env for ZROK_API_ENDPOINT default (#47)

This commit is contained in:
Michael Quigley 2022-09-01 13:57:02 -04:00
parent 2042140a4b
commit 0f9360f924
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -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)
}