1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

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.
This commit is contained in:
Carlos Alexandro Becker 2018-07-21 19:41:06 -03:00 committed by GitHub
parent 1f5239f9e9
commit 170e6c6b25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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),