diff --git a/client_test.go b/client_test.go index 34510b1..be9b51d 100644 --- a/client_test.go +++ b/client_test.go @@ -1,20 +1,11 @@ package client import ( - "os" "testing" "github.com/stretchr/testify/assert" ) -func getEnv(key, fallback string) string { - value, exist := os.LookupEnv(key) - if !exist { - return fallback - } - return value -} - func getDefaultConfig() Config { return Config{ URL: getEnv("NEXUS_URL", "http://127.0.0.1:8081"), diff --git a/tools.go b/tools.go index 14cd168..ca34ff6 100644 --- a/tools.go +++ b/tools.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "os" ) func jsonMarshalInterfaceToIOReader(data interface{}) (io.Reader, error) { @@ -15,3 +16,10 @@ func jsonMarshalInterfaceToIOReader(data interface{}) (io.Reader, error) { return bytes.NewReader(b), nil } + +func getEnv(key, fallback string) string { + if value, exists := os.LookupEnv(key); exists { + return value + } + return fallback +}