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:
parent
1f5239f9e9
commit
170e6c6b25
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user