From c84733505b8aae697a606772acff87cef87fde79 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Fri, 20 Feb 2026 18:37:33 +0100 Subject: [PATCH] Google Drive SDK does not bail on bad configuration (#733) --- internal/storage/googledrive/googledrive.go | 5 ++++- test/googledrive/docker-compose.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/storage/googledrive/googledrive.go b/internal/storage/googledrive/googledrive.go index 2e8d917..aff3836 100644 --- a/internal/storage/googledrive/googledrive.go +++ b/internal/storage/googledrive/googledrive.go @@ -12,13 +12,14 @@ import ( "time" "crypto/tls" + "net/http" + "github.com/offen/docker-volume-backup/internal/errwrap" "github.com/offen/docker-volume-backup/internal/storage" "golang.org/x/oauth2" "golang.org/x/oauth2/google" "google.golang.org/api/drive/v3" "google.golang.org/api/option" - "net/http" ) type googleDriveStorage struct { @@ -47,6 +48,8 @@ func NewStorageBackend(opts Config, logFunc storage.Log) (storage.Backend, error } if opts.ImpersonateSubject != "" { config.Subject = opts.ImpersonateSubject + } else { + return nil, errwrap.Wrap(nil, "GOOGLE_DRIVE_IMPERSONATE_SUBJECT cannot be left blank") } if opts.TokenURL != "" { config.TokenURL = opts.TokenURL diff --git a/test/googledrive/docker-compose.yml b/test/googledrive/docker-compose.yml index 41df5d0..ec3fd1f 100644 --- a/test/googledrive/docker-compose.yml +++ b/test/googledrive/docker-compose.yml @@ -36,6 +36,7 @@ services: GOOGLE_DRIVE_ENDPOINT: http://openapi_mock:8080 GOOGLE_DRIVE_TOKEN_URL: http://oauth2_mock:8090/issuer1/token GOOGLE_DRIVE_CREDENTIALS_JSON_FILE: /etc/gdrive/credentials.json + GOOGLE_DRIVE_IMPERSONATE_SUBJECT: me@example.com GOOGLE_DRIVE_FOLDER_ID: "root" volumes: - app_data:/backup/app_data:ro