Add gdrive-chunk-size

This commit is contained in:
Andrea Spacca
2019-03-18 20:52:38 +01:00
parent 5310566b81
commit 5fa36e25c8
3 changed files with 15 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/fatih/color"
"github.com/minio/cli"
"log"
"google.golang.org/api/googleapi"
)
var Version = "0.1"
@ -126,6 +127,11 @@ var globalFlags = []cli.Flag{
Usage: "",
Value: "",
},
cli.IntFlag{
Name: "gdrive-chunk-size",
Usage: "",
Value: googleapi.DefaultUploadChunkSize,
},
cli.IntFlag{
Name: "rate-limit",
Usage: "requests per minute",
@ -294,13 +300,15 @@ func New() *Cmd {
options = append(options, server.UseStorage(storage))
}
case "gdrive":
chunkSize := c.Int("gdrive-chunk-size")
if clientJsonFilepath := c.String("gdrive-client-json-filepath"); clientJsonFilepath == "" {
panic("client-json-filepath not set.")
} else if localConfigPath := c.String("gdrive-local-config-path"); localConfigPath == "" {
panic("local-config-path not set.")
} else if basedir := c.String("basedir"); basedir == "" {
panic("basedir not set.")
} else if storage, err := server.NewGDriveStorage(clientJsonFilepath, localConfigPath, basedir, logger); err != nil {
} else if storage, err := server.NewGDriveStorage(clientJsonFilepath, localConfigPath, basedir, chunkSize, logger); err != nil {
panic(err)
} else {
options = append(options, server.UseStorage(storage))