Skip to content

Commit cd9c56e

Browse files
committed
GDrive: Check gdrive-local-config-path on Oauth2
Check localConfigPath == "" on NEWGDriveStorage()
1 parent 2675350 commit cd9c56e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cmd/cmd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,10 @@ func New() *Cmd {
471471
}
472472
case "gdrive":
473473
chunkSize := c.Int("gdrive-chunk-size") * 1024 * 1024
474+
localConfigPath = c.String("gdrive-local-config-path")
474475

475476
if clientJSONFilepath := c.String("gdrive-client-json-filepath"); clientJSONFilepath == "" {
476477
panic("client-json-filepath not set.")
477-
} else if localConfigPath := c.String("gdrive-local-config-path"); localConfigPath == "" {
478-
panic("local-config-path not set.")
479478
} else if basedir := c.String("basedir"); basedir == "" {
480479
panic("basedir not set.")
481480
} else if store, err := storage.NewGDriveStorage(clientJSONFilepath, localConfigPath, basedir, chunkSize, logger); err != nil {

server/storage/gdrive.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ func NewGDriveStorage(clientJSONFilepath string, localConfigPath string, basedir
5252
logger.Println("GDrive: using Service Account credentials")
5353
httpClient = JWTConfigFromJSON(b, logger).Client(ctx)
5454
} else {
55+
if localConfigPath == "" {
56+
panic("local-config-path not set.")
57+
}
5558
logger.Println("GDrive: using OAuth2 credentials")
5659
config, err := google.ConfigFromJSON(b, drive.DriveScope, drive.DriveMetadataScope)
5760
if err != nil {

0 commit comments

Comments
 (0)