From f4e872c7825d5e91ecc067f28e56243935cc46e0 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 15 Mar 2020 11:40:06 +0100 Subject: [PATCH] portable mode: add flags for s3 upload part size and concurrency --- cmd/portable.go | 20 +++++++++++++------- docs/portable-mode.md | 3 ++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/cmd/portable.go b/cmd/portable.go index 9055eb93..1340437c 100644 --- a/cmd/portable.go +++ b/cmd/portable.go @@ -37,6 +37,8 @@ var ( portableS3Endpoint string portableS3StorageClass string portableS3KeyPrefix string + portableS3ULPartSize int + portableS3ULConcurrency int portableGCSBucket string portableGCSCredentialsFile string portableGCSAutoCredentials int @@ -101,13 +103,15 @@ Please take a look at the usage below to customize the serving parameters`, FsConfig: dataprovider.Filesystem{ Provider: portableFsProvider, S3Config: vfs.S3FsConfig{ - Bucket: portableS3Bucket, - Region: portableS3Region, - AccessKey: portableS3AccessKey, - AccessSecret: portableS3AccessSecret, - Endpoint: portableS3Endpoint, - StorageClass: portableS3StorageClass, - KeyPrefix: portableS3KeyPrefix, + Bucket: portableS3Bucket, + Region: portableS3Region, + AccessKey: portableS3AccessKey, + AccessSecret: portableS3AccessSecret, + Endpoint: portableS3Endpoint, + StorageClass: portableS3StorageClass, + KeyPrefix: portableS3KeyPrefix, + UploadPartSize: int64(portableS3ULPartSize), + UploadConcurrency: portableS3ULConcurrency, }, GCSConfig: vfs.GCSFsConfig{ Bucket: portableGCSBucket, @@ -160,6 +164,8 @@ func init() { portableCmd.Flags().StringVar(&portableS3StorageClass, "s3-storage-class", "", "") portableCmd.Flags().StringVar(&portableS3KeyPrefix, "s3-key-prefix", "", "Allows to restrict access to the virtual folder "+ "identified by this prefix and its contents") + portableCmd.Flags().IntVar(&portableS3ULPartSize, "s3-upload-part-size", 5, "The buffer size for multipart uploads (MB)") + portableCmd.Flags().IntVar(&portableS3ULConcurrency, "s3-upload-concurrency", 2, "How many parts are uploaded in parallel") portableCmd.Flags().StringVar(&portableGCSBucket, "gcs-bucket", "", "") portableCmd.Flags().StringVar(&portableGCSStorageClass, "gcs-storage-class", "", "") portableCmd.Flags().StringVar(&portableGCSKeyPrefix, "gcs-key-prefix", "", "Allows to restrict access to the virtual folder "+ diff --git a/docs/portable-mode.md b/docs/portable-mode.md index d013f868..4c8ebf61 100644 --- a/docs/portable-mode.md +++ b/docs/portable-mode.md @@ -37,10 +37,11 @@ Flags: --s3-key-prefix string Allows to restrict access to the virtual folder identified by this prefix and its contents --s3-region string --s3-storage-class string + --s3-upload-concurrency int How many parts are uploaded in parallel (default 2) + --s3-upload-part-size int The buffer size for multipart uploads (MB) (default 5) -s, --sftpd-port int 0 means a random non privileged port -c, --ssh-commands strings SSH commands to enable. "*" means any supported SSH command including scp (default [md5sum,sha1sum,cd,pwd]) -u, --username string Leave empty to use an auto generated value - ``` In portable mode, SFTPGo can advertise the SFTP service and, optionally, the credentials via multicast DNS, so there is a standard way to discover the service and to automatically connect to it.