mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-19 15:22:40 +02:00
Google Drive SDK does not bail on bad configuration (#733)
This commit is contained in:
@@ -12,13 +12,14 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/offen/docker-volume-backup/internal/errwrap"
|
"github.com/offen/docker-volume-backup/internal/errwrap"
|
||||||
"github.com/offen/docker-volume-backup/internal/storage"
|
"github.com/offen/docker-volume-backup/internal/storage"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"golang.org/x/oauth2/google"
|
"golang.org/x/oauth2/google"
|
||||||
"google.golang.org/api/drive/v3"
|
"google.golang.org/api/drive/v3"
|
||||||
"google.golang.org/api/option"
|
"google.golang.org/api/option"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type googleDriveStorage struct {
|
type googleDriveStorage struct {
|
||||||
@@ -47,6 +48,8 @@ func NewStorageBackend(opts Config, logFunc storage.Log) (storage.Backend, error
|
|||||||
}
|
}
|
||||||
if opts.ImpersonateSubject != "" {
|
if opts.ImpersonateSubject != "" {
|
||||||
config.Subject = opts.ImpersonateSubject
|
config.Subject = opts.ImpersonateSubject
|
||||||
|
} else {
|
||||||
|
return nil, errwrap.Wrap(nil, "GOOGLE_DRIVE_IMPERSONATE_SUBJECT cannot be left blank")
|
||||||
}
|
}
|
||||||
if opts.TokenURL != "" {
|
if opts.TokenURL != "" {
|
||||||
config.TokenURL = opts.TokenURL
|
config.TokenURL = opts.TokenURL
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ services:
|
|||||||
GOOGLE_DRIVE_ENDPOINT: http://openapi_mock:8080
|
GOOGLE_DRIVE_ENDPOINT: http://openapi_mock:8080
|
||||||
GOOGLE_DRIVE_TOKEN_URL: http://oauth2_mock:8090/issuer1/token
|
GOOGLE_DRIVE_TOKEN_URL: http://oauth2_mock:8090/issuer1/token
|
||||||
GOOGLE_DRIVE_CREDENTIALS_JSON_FILE: /etc/gdrive/credentials.json
|
GOOGLE_DRIVE_CREDENTIALS_JSON_FILE: /etc/gdrive/credentials.json
|
||||||
|
GOOGLE_DRIVE_IMPERSONATE_SUBJECT: me@example.com
|
||||||
GOOGLE_DRIVE_FOLDER_ID: "root"
|
GOOGLE_DRIVE_FOLDER_ID: "root"
|
||||||
volumes:
|
volumes:
|
||||||
- app_data:/backup/app_data:ro
|
- app_data:/backup/app_data:ro
|
||||||
|
|||||||
Reference in New Issue
Block a user