From d2cf55b83fe71d41c3a09b35b280d9a48b24088d Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Tue, 8 Aug 2017 02:20:56 +0100 Subject: Vault AWS EC2 auth (#190) --- aws/ec2meta.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'aws') 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} } -- cgit v1.2.3