add GDrive provider support (#118)
* GDrive provider support * More reliable basedir ownership * Fix mimetype
This commit is contained in:
committed by
Remco Verhoef
parent
d0c7241b31
commit
82493d6dcb
26
cmd/cmd.go
26
cmd/cmd.go
@ -74,7 +74,7 @@ var globalFlags = []cli.Flag{
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "provider",
|
||||
Usage: "s3|local",
|
||||
Usage: "s3|gdrive|local",
|
||||
Value: "",
|
||||
},
|
||||
cli.StringFlag{
|
||||
@ -101,6 +101,18 @@ var globalFlags = []cli.Flag{
|
||||
Value: "",
|
||||
EnvVar: "BUCKET",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "gdrive-client-json-filepath",
|
||||
Usage: "",
|
||||
Value: "",
|
||||
EnvVar: "",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "gdrive-local-config-path",
|
||||
Usage: "",
|
||||
Value: "",
|
||||
EnvVar: "",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "rate-limit",
|
||||
Usage: "requests per minute",
|
||||
@ -233,6 +245,18 @@ func New() *Cmd {
|
||||
} else {
|
||||
options = append(options, server.UseStorage(storage))
|
||||
}
|
||||
case "gdrive":
|
||||
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); err != nil {
|
||||
panic(err)
|
||||
} else {
|
||||
options = append(options, server.UseStorage(storage))
|
||||
}
|
||||
case "local":
|
||||
if v := c.String("basedir"); v == "" {
|
||||
panic("basedir not set.")
|
||||
|
Reference in New Issue
Block a user