mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-16 12:08:04 +00:00
Allow credentials for S3 SigV2 to be specified in config once again. #356
This commit is contained in:
+12
-5
@@ -66,10 +66,6 @@ func NewPublishedStorageRaw(
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func signV2(req *request.Request) {
|
|
||||||
awsauth.SignS3(req.HTTPRequest)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewPublishedStorage creates new instance of PublishedStorage with specified S3 access
|
// NewPublishedStorage creates new instance of PublishedStorage with specified S3 access
|
||||||
// keys, region and bucket name
|
// keys, region and bucket name
|
||||||
func NewPublishedStorage(accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix,
|
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)
|
encryptionMethod, plusWorkaround, disableMultiDel, config)
|
||||||
|
|
||||||
if err == nil && forceSigV2 {
|
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.Clear()
|
||||||
result.s3.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler)
|
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
|
return result, err
|
||||||
|
|||||||
Reference in New Issue
Block a user