Skip to content

Commit 6d3112c

Browse files
committed
Allow to disable optional initialization steps: --no-multipart-expire --no-detect
1 parent 983bd0e commit 6d3112c

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

internal/backend_s3.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ func (s *S3Backend) Init(key string) error {
393393
var isAws bool
394394
var err error
395395

396+
if s.config.NoDetect {
397+
return nil
398+
}
399+
396400
if !s.config.RegionSet {
397401
err, _ = s.detectBucketLocationByHEAD()
398402
if err == nil {
@@ -1187,6 +1191,10 @@ func (s *S3Backend) MultipartBlobAbort(param *MultipartBlobCommitInput) (*Multip
11871191
}
11881192

11891193
func (s *S3Backend) MultipartExpire(param *MultipartExpireInput) (*MultipartExpireOutput, error) {
1194+
if s.config.NoExpireMultipart {
1195+
return &MultipartExpireOutput{}, nil
1196+
}
1197+
11901198
mpu, err := s.ListMultipartUploads(&s3.ListMultipartUploadsInput{
11911199
Bucket: &s.bucket,
11921200
})

internal/cfg/conf_s3.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ type S3Config struct {
5454
ColdMinSize uint64
5555
MultipartAge time.Duration
5656

57+
NoExpireMultipart bool
58+
5759
MultipartCopyThreshold uint64
5860

61+
NoDetect bool
5962
UseSSE bool
6063
UseKMS bool
6164
KMSKeyID string

internal/cfg/flags.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,16 @@ MISC OPTIONS:
254254
Value: "",
255255
},
256256

257+
cli.BoolFlag{
258+
Name: "no-detect",
259+
Usage: "Turn off bucket location and signature algorithm autodetection on start",
260+
},
261+
262+
cli.BoolFlag{
263+
Name: "no-expire-multipart",
264+
Usage: "Do not expire multipart uploads older than --multipart-age on start",
265+
},
266+
257267
cli.StringFlag{
258268
Name: "multipart-age",
259269
Usage: "Multipart uploads older than this value will be deleted on start",
@@ -947,6 +957,9 @@ func PopulateFlags(c *cli.Context) (ret *FlagStorage) {
947957

948958
config.MultipartCopyThreshold = uint64(c.Int("multipart-copy-threshold")) * 1024 * 1024
949959

960+
config.NoExpireMultipart = c.Bool("no-expire-multipart")
961+
config.NoDetect = c.Bool("no-detect")
962+
950963
config.SDKMaxRetries = c.Int("sdk-max-retries")
951964
config.SDKMinRetryDelay = c.Duration("sdk-min-retry-delay")
952965
config.SDKMaxRetryDelay = c.Duration("sdk-max-retry-delay")

0 commit comments

Comments
 (0)