mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-12-23 01:20:20 +01:00
Allow path to be set for bucket storage (#52)
This commit is contained in:
parent
1db896f7cf
commit
6fe629ce87
@ -135,7 +135,7 @@ You can populate below template according to your requirements and use it as you
|
||||
# Please note that you will need to escape the `$` when providing the value
|
||||
# in a docker-compose.yml file, i.e. using $$VAR instead of $VAR.
|
||||
|
||||
# BACKUP_FILENAME_TEMPLATE="true"
|
||||
# BACKUP_FILENAME_EXPAND="true"
|
||||
|
||||
# When storing local backups, a symlink to the latest backup can be created
|
||||
# in case a value is given for this key. This has no effect on remote backups.
|
||||
@ -156,6 +156,11 @@ You can populate below template according to your requirements and use it as you
|
||||
|
||||
# AWS_S3_BUCKET_NAME="backup-bucket"
|
||||
|
||||
# If you want to store the backup in a non-root location on your bucket
|
||||
# you can provide a path. The path must not contain a leading slash.
|
||||
|
||||
# AWS_S3_PATH="my/backup/location"
|
||||
|
||||
# Define credentials for authenticating against the backup storage and a bucket
|
||||
# name. Although all of these keys are `AWS`-prefixed, the setup can be used
|
||||
# with any S3 compatible storage.
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user