diff options
| author | Stuart Clark <stuart.clark@Jahingo.com> | 2017-08-08 02:20:56 +0100 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2017-08-07 21:20:56 -0400 |
| commit | d2cf55b83fe71d41c3a09b35b280d9a48b24088d (patch) | |
| tree | cc152e6ed7d4f2346d179bb867a683e47a3d9852 /aws | |
| parent | cbc2af15fccdfc43ae6dfc2ae2d88248df039ddb (diff) | |
Vault AWS EC2 auth (#190)
Diffstat (limited to 'aws')
| -rw-r--r-- | aws/ec2meta.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/aws/ec2meta.go b/aws/ec2meta.go index 0e5cba64..cc3766b7 100644 --- a/aws/ec2meta.go +++ b/aws/ec2meta.go @@ -7,10 +7,12 @@ import ( "net/http" "strings" "time" + + "github.com/hairyhenderson/gomplate/env" ) // DefaultEndpoint - -const DefaultEndpoint = "http://169.254.169.254" +var DefaultEndpoint = "http://169.254.169.254" // Ec2Meta - type Ec2Meta struct { @@ -23,6 +25,10 @@ type Ec2Meta struct { // NewEc2Meta - func NewEc2Meta(options ClientOptions) *Ec2Meta { + if endpoint := env.Getenv("AWS_META_ENDPOINT"); endpoint != "" { + DefaultEndpoint = endpoint + } + return &Ec2Meta{cache: make(map[string]string), options: options} } |
