summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2021-01-17 19:24:21 -0500
committerDave Henderson <dhenderson@gmail.com>2021-01-17 19:24:21 -0500
commite767898ad2e1b6f3d5cbd613eb1cb6e4cd501ff3 (patch)
treefbb790a2bf131c7f67357cbd1398c97a9da1aa3a
parent9eb3469a26a797e3a79788e6ed9d93fb598f4f8e (diff)
Prefer env.Getenv to os.Getenv
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
-rw-r--r--aws/ec2info.go5
-rw-r--r--gcp/meta.go3
-rw-r--r--vault/auth.go2
3 files changed, 5 insertions, 5 deletions
diff --git a/aws/ec2info.go b/aws/ec2info.go
index 30146553..366fc7ff 100644
--- a/aws/ec2info.go
+++ b/aws/ec2info.go
@@ -11,6 +11,7 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
+ "github.com/hairyhenderson/gomplate/v3/env"
"github.com/pkg/errors"
)
@@ -44,7 +45,7 @@ type InstanceDescriber interface {
// ... but cannot use in vault/auth.go as different strconv.Atoi error handling
func GetClientOptions() ClientOptions {
coInit.Do(func() {
- timeout := os.Getenv("AWS_TIMEOUT")
+ timeout := env.Getenv("AWS_TIMEOUT")
if timeout == "" {
timeout = "500"
}
@@ -71,7 +72,7 @@ func SDKSession(region ...string) *session.Session {
config := aws.NewConfig()
config = config.WithHTTPClient(&http.Client{Timeout: timeout})
- if os.Getenv("AWS_ANON") == "true" {
+ if env.Getenv("AWS_ANON") == "true" {
config = config.WithCredentials(credentials.AnonymousCredentials)
}
diff --git a/gcp/meta.go b/gcp/meta.go
index 2ba8cf92..9c74d5de 100644
--- a/gcp/meta.go
+++ b/gcp/meta.go
@@ -3,7 +3,6 @@ package gcp
import (
"io/ioutil"
"net/http"
- "os"
"strconv"
"strings"
"sync"
@@ -33,7 +32,7 @@ type ClientOptions struct {
// ... but cannot use in vault/auth.go as different strconv.Atoi error handling
func GetClientOptions() ClientOptions {
coInit.Do(func() {
- timeout := os.Getenv("GCP_TIMEOUT")
+ timeout := env.Getenv("GCP_TIMEOUT")
if timeout == "" {
timeout = "500"
}
diff --git a/vault/auth.go b/vault/auth.go
index 0c82450c..83b31ce8 100644
--- a/vault/auth.go
+++ b/vault/auth.go
@@ -200,7 +200,7 @@ func createEc2LoginVars(nonce string) (map[string]interface{}, error) {
}
opts := aws.ClientOptions{
- Timeout: time.Duration(conv.MustAtoi(os.Getenv("AWS_TIMEOUT"))) * time.Millisecond,
+ Timeout: time.Duration(conv.MustAtoi(env.Getenv("AWS_TIMEOUT"))) * time.Millisecond,
}
meta := aws.NewEc2Meta(opts)