Skip to content
Permalink
Browse files

feat: s3: credentials from env as well (#733)

closes #731 

uses the chained credential provider to get either from the config file or from env.
  • Loading branch information...
caarlos0 committed Jul 21, 2018
1 parent 1f5239f commit 170e6c6b25b0f3375ebf409651e38874b1199d2e
Showing with 6 additions and 4 deletions.
  1. +6 −4 pipeline/s3/s3.go
@@ -64,10 +64,12 @@ func upload(ctx *context.Context, conf config.S3) error {
awsConfig.Endpoint = aws.String(conf.Endpoint)
awsConfig.S3ForcePathStyle = aws.Bool(true)
}
// TODO: add a test for this
if conf.Profile != "" {
awsConfig.Credentials = credentials.NewSharedCredentials("", conf.Profile)
}
awsConfig.Credentials = credentials.NewChainCredentials([]credentials.Provider{
&credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{
Profile: conf.Profile,
},
})
sess := session.Must(session.NewSession(awsConfig))
svc := s3.New(sess, &aws.Config{
Region: aws.String(conf.Region),

0 comments on commit 170e6c6

Please sign in to comment.
You can’t perform that action at this time.