mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-03 05:00:56 +00:00
add forceVirtualHostedStyle for stores which only support virtual hosted style
This commit is contained in:
+1
-1
@@ -393,7 +393,7 @@ func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedSto
|
|||||||
params.AccessKeyID, params.SecretAccessKey, params.SessionToken,
|
params.AccessKeyID, params.SecretAccessKey, params.SessionToken,
|
||||||
params.Region, params.Endpoint, params.Bucket, params.ACL, params.Prefix, params.StorageClass,
|
params.Region, params.Endpoint, params.Bucket, params.ACL, params.Prefix, params.StorageClass,
|
||||||
params.EncryptionMethod, params.PlusWorkaround, params.DisableMultiDel,
|
params.EncryptionMethod, params.PlusWorkaround, params.DisableMultiDel,
|
||||||
params.ForceSigV2, params.Debug)
|
params.ForceSigV2, params.ForceVirtualHostedStyle, params.Debug)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatal(err)
|
Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ Configuration file is stored in JSON format (default values shown below):
|
|||||||
"plusWorkaround": false,
|
"plusWorkaround": false,
|
||||||
"disableMultiDel": false,
|
"disableMultiDel": false,
|
||||||
"forceSigV2": false,
|
"forceSigV2": false,
|
||||||
|
"forceVirtualHostedStyle": false,
|
||||||
"debug": false
|
"debug": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -265,6 +266,10 @@ bucket name
|
|||||||
(optional) disable Signature V4 support, useful with non\-AWS S3\-compatible object stores which do not support SigV4, shouldn\(cqt be enabled for AWS
|
(optional) disable Signature V4 support, useful with non\-AWS S3\-compatible object stores which do not support SigV4, shouldn\(cqt be enabled for AWS
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
\fBforceVirtualHostedStyle\fR
|
||||||
|
(optional) disable path style visit, useful with non\-AWS S3\-compatible object stores which only support virtual hosted style
|
||||||
|
.
|
||||||
|
.TP
|
||||||
\fBdebug\fR
|
\fBdebug\fR
|
||||||
(optional) enables detailed request/response dump for each S3 operation
|
(optional) enables detailed request/response dump for each S3 operation
|
||||||
.
|
.
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ Configuration file is stored in JSON format (default values shown below):
|
|||||||
"plusWorkaround": false,
|
"plusWorkaround": false,
|
||||||
"disableMultiDel": false,
|
"disableMultiDel": false,
|
||||||
"forceSigV2": false,
|
"forceSigV2": false,
|
||||||
|
"forceVirtualHostedStyle": true,
|
||||||
"debug": false
|
"debug": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -251,6 +252,9 @@ and associated settings:
|
|||||||
* `forceSigV2`:
|
* `forceSigV2`:
|
||||||
(optional) disable Signature V4 support, useful with non-AWS S3-compatible object stores
|
(optional) disable Signature V4 support, useful with non-AWS S3-compatible object stores
|
||||||
which do not support SigV4, shouldn't be enabled for AWS
|
which do not support SigV4, shouldn't be enabled for AWS
|
||||||
|
* `forceVirtualHostedStyle`:
|
||||||
|
(optional) disable path style visit, useful with non-AWS S3-compatible object stores
|
||||||
|
which only support virtual hosted style
|
||||||
* `debug`:
|
* `debug`:
|
||||||
(optional) enables detailed request/response dump for each S3 operation
|
(optional) enables detailed request/response dump for each S3 operation
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -79,15 +79,19 @@ func NewPublishedStorageRaw(
|
|||||||
|
|
||||||
// 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(
|
||||||
storageClass, encryptionMethod string, plusWorkaround, disableMultiDel, forceSigV2, debug bool) (*PublishedStorage, error) {
|
accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix, storageClass, encryptionMethod string,
|
||||||
|
plusWorkaround, disableMultiDel, forceSigV2, forceVirtualHostedStyle, debug bool) (*PublishedStorage, error) {
|
||||||
|
|
||||||
config := &aws.Config{
|
config := &aws.Config{
|
||||||
Region: aws.String(region),
|
Region: aws.String(region),
|
||||||
}
|
}
|
||||||
|
|
||||||
if endpoint != "" {
|
if endpoint != "" {
|
||||||
config = config.WithEndpoint(endpoint).WithS3ForcePathStyle(true)
|
config = config.WithEndpoint(endpoint)
|
||||||
|
if !forceVirtualHostedStyle {
|
||||||
|
config = config.WithS3ForcePathStyle(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if accessKey != "" {
|
if accessKey != "" {
|
||||||
|
|||||||
+3
-3
@@ -29,11 +29,11 @@ func (s *PublishedStorageSuite) SetUpTest(c *C) {
|
|||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
c.Assert(s.srv, NotNil)
|
c.Assert(s.srv, NotNil)
|
||||||
|
|
||||||
s.storage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "test", "", "", "", "", false, true, false, false)
|
s.storage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "test", "", "", "", "", false, true, false, false, false)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
s.prefixedStorage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "test", "", "lala", "", "", false, true, false, false)
|
s.prefixedStorage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "test", "", "lala", "", "", false, true, false, false, false)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
s.noSuchBucketStorage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "no-bucket", "", "", "", "", false, true, false, false)
|
s.noSuchBucketStorage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "no-bucket", "", "", "", "", false, true, false, false, false)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
_, err = s.storage.s3.CreateBucket(&s3.CreateBucketInput{Bucket: aws.String("test")})
|
_, err = s.storage.s3.CreateBucket(&s3.CreateBucketInput{Bucket: aws.String("test")})
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ type S3PublishRoot struct {
|
|||||||
PlusWorkaround bool `json:"plusWorkaround"`
|
PlusWorkaround bool `json:"plusWorkaround"`
|
||||||
DisableMultiDel bool `json:"disableMultiDel"`
|
DisableMultiDel bool `json:"disableMultiDel"`
|
||||||
ForceSigV2 bool `json:"forceSigV2"`
|
ForceSigV2 bool `json:"forceSigV2"`
|
||||||
|
ForceVirtualHostedStyle bool `json:"forceVirtualHostedStyle"`
|
||||||
Debug bool `json:"debug"`
|
Debug bool `json:"debug"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
|||||||
" \"plusWorkaround\": false,\n"+
|
" \"plusWorkaround\": false,\n"+
|
||||||
" \"disableMultiDel\": false,\n"+
|
" \"disableMultiDel\": false,\n"+
|
||||||
" \"forceSigV2\": false,\n"+
|
" \"forceSigV2\": false,\n"+
|
||||||
|
" \"forceVirtualHostedStyle\": false,\n"+
|
||||||
" \"debug\": false\n"+
|
" \"debug\": false\n"+
|
||||||
" }\n"+
|
" }\n"+
|
||||||
" },\n"+
|
" },\n"+
|
||||||
|
|||||||
Reference in New Issue
Block a user