You've already forked docker-volume-backup
mirror of
https://github.com/offen/docker-volume-backup.git
synced 2025-11-23 21:44:40 +02:00
feat: Add Google Drive storage backend with custom endpoint support (#613)
* feat: Add Google Drive storage backend with custom endpoint support - Implement Google Drive storage backend using service account authentication - Add support for custom Google Drive API endpoints for testing - Include comprehensive test setup with mock services - Add configuration options for Google Drive credentials and folder ID - Update documentation with Google Drive configuration examples * remove debug messages * Improve tests * Add mounting tip on documentation * Replace deprecated lib usage * Fix identation * Fix googledrive tests * Fix googledrive support for _FILE credentials * Remove googledrive test unecessary echos
This commit is contained in:
committed by
GitHub
parent
4ad98af88d
commit
a5579b5abb
@@ -87,6 +87,11 @@ type Config struct {
|
||||
DropboxAppSecret string `split_words:"true"`
|
||||
DropboxRemotePath string `split_words:"true"`
|
||||
DropboxConcurrencyLevel NaturalNumber `split_words:"true" default:"6"`
|
||||
GoogleDriveCredentialsJSON string `split_words:"true"`
|
||||
GoogleDriveFolderID string `split_words:"true"`
|
||||
GoogleDriveImpersonateSubject string `split_words:"true"`
|
||||
GoogleDriveEndpoint string `split_words:"true"`
|
||||
GoogleDriveTokenURL string `split_words:"true"`
|
||||
source string
|
||||
additionalEnvVars map[string]string
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/offen/docker-volume-backup/internal/storage"
|
||||
"github.com/offen/docker-volume-backup/internal/storage/azure"
|
||||
"github.com/offen/docker-volume-backup/internal/storage/dropbox"
|
||||
"github.com/offen/docker-volume-backup/internal/storage/googledrive"
|
||||
"github.com/offen/docker-volume-backup/internal/storage/local"
|
||||
"github.com/offen/docker-volume-backup/internal/storage/s3"
|
||||
"github.com/offen/docker-volume-backup/internal/storage/ssh"
|
||||
@@ -59,12 +60,13 @@ func newScript(c *Config) *script {
|
||||
StartTime: time.Now(),
|
||||
LogOutput: logBuffer,
|
||||
Storages: map[string]StorageStats{
|
||||
"S3": {},
|
||||
"WebDAV": {},
|
||||
"SSH": {},
|
||||
"Local": {},
|
||||
"Azure": {},
|
||||
"Dropbox": {},
|
||||
"S3": {},
|
||||
"WebDAV": {},
|
||||
"SSH": {},
|
||||
"Local": {},
|
||||
"Azure": {},
|
||||
"Dropbox": {},
|
||||
"GoogleDrive": {},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -225,6 +227,21 @@ func (s *script) init() error {
|
||||
s.storages = append(s.storages, dropboxBackend)
|
||||
}
|
||||
|
||||
if s.c.GoogleDriveCredentialsJSON != "" {
|
||||
googleDriveConfig := googledrive.Config{
|
||||
CredentialsJSON: s.c.GoogleDriveCredentialsJSON,
|
||||
FolderID: s.c.GoogleDriveFolderID,
|
||||
ImpersonateSubject: s.c.GoogleDriveImpersonateSubject,
|
||||
Endpoint: s.c.GoogleDriveEndpoint,
|
||||
TokenURL: s.c.GoogleDriveTokenURL,
|
||||
}
|
||||
googleDriveBackend, err := googledrive.NewStorageBackend(googleDriveConfig, logFunc)
|
||||
if err != nil {
|
||||
return errwrap.Wrap(err, "error creating googledrive storage backend")
|
||||
}
|
||||
s.storages = append(s.storages, googleDriveBackend)
|
||||
}
|
||||
|
||||
if s.c.EmailNotificationRecipient != "" {
|
||||
emailURL := fmt.Sprintf(
|
||||
"smtp://%s:%s@%s:%d/?from=%s&to=%s",
|
||||
|
||||
Reference in New Issue
Block a user