Remove maxUploadParts and PartSize options

This commit is contained in:
n8225 2019-08-22 14:10:11 -05:00
parent 372ff5f368
commit ce7e008bb3
3 changed files with 4 additions and 11 deletions

View file

@ -163,9 +163,9 @@ provider | which storage provider to use | (s3, grdrive or local) |
aws-access-key | aws access key | | AWS_ACCESS_KEY aws-access-key | aws access key | | AWS_ACCESS_KEY
aws-secret-key | aws access key | | AWS_SECRET_KEY aws-secret-key | aws access key | | AWS_SECRET_KEY
bucket | aws bucket | | BUCKET bucket | aws bucket | | BUCKET
s3-endpoint | Custom S3 endpoint. | |
s3-region | region of the s3 bucket | eu-west-1 | S3_REGION s3-region | region of the s3 bucket | eu-west-1 | S3_REGION
s3-no-multipart | disables s3 multipart upload | false | | s3-no-multipart | disables s3 multipart upload | false | |
s3-part-size | Size of parts for S3 multipart upload. | 5(MB) | |
s3-path-style | Forces path style URLs, required for Minio. | false | | s3-path-style | Forces path style URLs, required for Minio. | false | |
basedir | path storage for local/gdrive provider| | basedir | path storage for local/gdrive provider| |
gdrive-client-json-filepath | path to oauth client json config for gdrive provider| | gdrive-client-json-filepath | path to oauth client json config for gdrive provider| |

View file

@ -130,11 +130,6 @@ var globalFlags = []cli.Flag{
Name: "s3-no-multipart", Name: "s3-no-multipart",
Usage: "Disables S3 Multipart Puts", Usage: "Disables S3 Multipart Puts",
}, },
cli.Int64Flag{
Name: "s3-part-size",
Usage: "Size of parts for S3 multipart upload, default 5(MB)",
Value: 5,
},
cli.BoolFlag{ cli.BoolFlag{
Name: "s3-path-style", Name: "s3-path-style",
Usage: "Forces path style URLs, required for Minio.", Usage: "Forces path style URLs, required for Minio.",

View file

@ -130,13 +130,12 @@ type S3Storage struct {
s3 *s3.S3 s3 *s3.S3
logger *log.Logger logger *log.Logger
noMultipart bool noMultipart bool
partSize int64
} }
func NewS3Storage(accessKey, secretKey, bucketName, region, endpoint string, logger *log.Logger, disableMultipart bool, partSize int64, forcePathStyle bool) (*S3Storage, error) { func NewS3Storage(accessKey, secretKey, bucketName, region, endpoint string, logger *log.Logger, disableMultipart bool, forcePathStyle bool) (*S3Storage, error) {
sess := getAwsSession(accessKey, secretKey, region, endpoint, forcePathStyle) sess := getAwsSession(accessKey, secretKey, region, endpoint, forcePathStyle)
return &S3Storage{bucket: bucketName, s3: s3.New(sess), session: sess, logger: logger, noMultipart: disableMultipart, partSize: partSize}, nil return &S3Storage{bucket: bucketName, s3: s3.New(sess), session: sess, logger: logger, noMultipart: disableMultipart}, nil
} }
func (s *S3Storage) Type() string { func (s *S3Storage) Type() string {
@ -244,7 +243,6 @@ func (s *S3Storage) Put(token string, filename string, reader io.Reader, content
// Create an uploader with the session and custom options // Create an uploader with the session and custom options
uploader := s3manager.NewUploader(s.session, func(u *s3manager.Uploader) { uploader := s3manager.NewUploader(s.session, func(u *s3manager.Uploader) {
u.PartSize = s.partSize * 1024 * 1024 // The minimum/default allowed part size is 5MB
u.Concurrency = concurrency // default is 5 u.Concurrency = concurrency // default is 5
u.LeavePartsOnError = false u.LeavePartsOnError = false
}) })