mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-19 19:28:22 +00:00
Allow credentials for S3 SigV2 to be specified in config once again. #356
This commit is contained in:
17
s3/public.go
17
s3/public.go
@@ -66,10 +66,6 @@ func NewPublishedStorageRaw(
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func signV2(req *request.Request) {
|
||||
awsauth.SignS3(req.HTTPRequest)
|
||||
}
|
||||
|
||||
// NewPublishedStorage creates new instance of PublishedStorage with specified S3 access
|
||||
// keys, region and bucket name
|
||||
func NewPublishedStorage(accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix,
|
||||
@@ -95,9 +91,20 @@ func NewPublishedStorage(accessKey, secretKey, sessionToken, region, endpoint, b
|
||||
encryptionMethod, plusWorkaround, disableMultiDel, config)
|
||||
|
||||
if err == nil && forceSigV2 {
|
||||
creds := []awsauth.Credentials{}
|
||||
|
||||
if accessKey != "" {
|
||||
creds = append(creds, awsauth.Credentials{
|
||||
AccessKeyID: accessKey,
|
||||
SecretAccessKey: secretKey,
|
||||
})
|
||||
}
|
||||
|
||||
result.s3.Handlers.Sign.Clear()
|
||||
result.s3.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler)
|
||||
result.s3.Handlers.Sign.PushBack(signV2)
|
||||
result.s3.Handlers.Sign.PushBack(func(req *request.Request) {
|
||||
awsauth.SignS3(req.HTTPRequest, creds...)
|
||||
})
|
||||
}
|
||||
|
||||
return result, err
|
||||
|
||||
Reference in New Issue
Block a user