From 4924ea821fff9daa72c2b5a80069cedab86b6b72 Mon Sep 17 00:00:00 2001 From: Peter Sanford Date: Sat, 22 Feb 2020 12:28:30 -0800 Subject: [PATCH] Support WORMHOLE_RELAY_URL env variable This allows you to specify the relay url via an environment variable to make it easier to globally set a non standard default. The cli flag --relay-url takes precedence over the environment variable. --- cmd/cmd.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/cmd.go b/cmd/cmd.go index 4229a40d..7c37418b 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -1,6 +1,8 @@ package cmd import ( + "os" + "github.com/spf13/cobra" ) @@ -22,6 +24,9 @@ var ( func Execute() error { rootCmd.PersistentFlags().StringVar(&relayURL, "relay-url", "", "rendezvous relay to use") + if relayURL == "" { + relayURL = os.Getenv("WORMHOLE_RELAY_URL") + } rootCmd.AddCommand(recvCommand()) rootCmd.AddCommand(sendCommand())