Allow path to be set for bucket storage (#52)

This commit is contained in:
Frederik Ring
2022-01-25 21:16:16 +01:00
committed by GitHub
parent 1db896f7cf
commit 6fe629ce87
2 changed files with 8 additions and 2 deletions

View File

@@ -115,6 +115,7 @@ type config struct {
BackupStopContainerLabel string `split_words:"true" default:"true"`
BackupFromSnapshot bool `split_words:"true"`
AwsS3BucketName string `split_words:"true"`
AwsS3Path string `split_words:"true"`
AwsEndpoint string `split_words:"true" default:"s3.amazonaws.com"`
AwsEndpointProto string `split_words:"true" default:"https"`
AwsEndpointInsecure bool `split_words:"true"`
@@ -525,7 +526,7 @@ func (s *script) encryptBackup() error {
func (s *script) copyBackup() error {
_, name := path.Split(s.file)
if s.minioClient != nil {
if _, err := s.minioClient.FPutObject(context.Background(), s.c.AwsS3BucketName, name, s.file, minio.PutObjectOptions{
if _, err := s.minioClient.FPutObject(context.Background(), s.c.AwsS3BucketName, filepath.Join(s.c.AwsS3Path, name), s.file, minio.PutObjectOptions{
ContentType: "application/tar+gzip",
}); err != nil {
return fmt.Errorf("copyBackup: error uploading backup to remote storage: %w", err)