add support for profile
This commit is contained in:
parent
3fb4162660
commit
a619759bf7
|
@ -2,6 +2,8 @@ package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/credentials"
|
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||||
|
@ -35,6 +37,12 @@ func (c *AccessConfig) Session() (*session.Session, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.ProfileName != "" {
|
||||||
|
if err := os.Setenv("AWS_PROFILE", c.ProfileName); err != nil {
|
||||||
|
log.Printf("Set env error: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
config := aws.NewConfig().WithRegion(region).WithMaxRetries(11).WithCredentialsChainVerboseErrors(true)
|
config := aws.NewConfig().WithRegion(region).WithMaxRetries(11).WithCredentialsChainVerboseErrors(true)
|
||||||
|
|
||||||
if c.CustomEndpointEc2 != "" {
|
if c.CustomEndpointEc2 != "" {
|
||||||
|
|
Loading…
Reference in New Issue