Save token that came from goamz + use it in go-sdk-aws
This commit is contained in:
parent
a0b9dc32c8
commit
503ffbd3be
|
@ -21,6 +21,7 @@ import (
|
||||||
type Config struct {
|
type Config struct {
|
||||||
AccessKey string
|
AccessKey string
|
||||||
SecretKey string
|
SecretKey string
|
||||||
|
Token string
|
||||||
Region string
|
Region string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ func (c *Config) Client() (interface{}, error) {
|
||||||
// bucket storage in S3
|
// bucket storage in S3
|
||||||
client.region = c.Region
|
client.region = c.Region
|
||||||
|
|
||||||
creds := awsGo.Creds(c.AccessKey, c.SecretKey, "")
|
creds := awsGo.Creds(c.AccessKey, c.SecretKey, c.Token)
|
||||||
|
|
||||||
log.Println("[INFO] Initializing EC2 connection")
|
log.Println("[INFO] Initializing EC2 connection")
|
||||||
client.ec2conn = ec2.New(auth, region)
|
client.ec2conn = ec2.New(auth, region)
|
||||||
|
@ -95,6 +96,7 @@ func (c *Config) AWSAuth() (aws.Auth, error) {
|
||||||
// Store the accesskey and secret that we got...
|
// Store the accesskey and secret that we got...
|
||||||
c.AccessKey = auth.AccessKey
|
c.AccessKey = auth.AccessKey
|
||||||
c.SecretKey = auth.SecretKey
|
c.SecretKey = auth.SecretKey
|
||||||
|
c.Token = auth.Token
|
||||||
}
|
}
|
||||||
|
|
||||||
return auth, err
|
return auth, err
|
||||||
|
|
Loading…
Reference in New Issue