Add the --delete-local-file-after-upload to delete local file after upload#143
Conversation
|
@orgrim What do you think? |
This version is implemented with the following patch: orgrim/pg_back#143
This version is implemented with the following patch: orgrim/pg_back#143
This version is implemented with the following patch: orgrim/pg_back#143
orgrim
left a comment
There was a problem hiding this comment.
Hi,
my old sysadmin habits make me like shorter names for options, what about --delete-uploaded that takes "yes" or "no" (so that any state in the configuration file can be overridden on CLI?
Would you mind rebasing on the master branch, please? The CI has been fixed.
Regards
|
is it possible to add some (basic) tests for that new flag ? |
8a244b0 to
450ae19
Compare
Some users don't see any interest in consuming disk space on the server where pg_back is running when the archives have been saved remotely, for example on a secure Object Storage service. This option allows to delete these intermediate files.
450ae19 to
412eb25
Compare
@orgrim done |
@orgrim done |
| { | ||
| []string{"--delete-uploaded", "yes"}, | ||
| options{ | ||
| Directory: "/var/backups/postgresql", | ||
| Format: 'c', | ||
| DirJobs: 1, | ||
| CompressLevel: -1, | ||
| Jobs: 1, | ||
| PauseTimeout: 3600, | ||
| PurgeInterval: -30 * 24 * time.Hour, | ||
| PurgeKeep: 0, | ||
| SumAlgo: "none", | ||
| CfgFile: "/etc/pg_back/pg_back.conf", | ||
| TimeFormat: timeFormat, | ||
| Encrypt: false, | ||
| CipherPassphrase: "", | ||
| WithRolePasswords: true, | ||
| Upload: "none", | ||
| Download: "none", | ||
| ListRemote: "none", | ||
| AzureEndpoint: "blob.core.windows.net", | ||
| B2ConcurrentConnections: 5, | ||
| DeleteUploaded: true, | ||
| }, | ||
| false, | ||
| false, | ||
| "", | ||
| "", | ||
| }, | ||
| { | ||
| []string{"--delete-uploaded", "true"}, | ||
| options{ | ||
| Directory: "/var/backups/postgresql", | ||
| Format: 'c', | ||
| DirJobs: 1, | ||
| CompressLevel: -1, | ||
| Jobs: 1, | ||
| PauseTimeout: 3600, | ||
| PurgeInterval: -30 * 24 * time.Hour, | ||
| PurgeKeep: 0, | ||
| SumAlgo: "none", | ||
| CfgFile: "/etc/pg_back/pg_back.conf", | ||
| TimeFormat: timeFormat, | ||
| Encrypt: false, | ||
| CipherPassphrase: "", | ||
| WithRolePasswords: true, | ||
| Upload: "none", | ||
| Download: "none", | ||
| ListRemote: "none", | ||
| AzureEndpoint: "blob.core.windows.net", | ||
| B2ConcurrentConnections: 5, | ||
| DeleteUploaded: true, | ||
| }, | ||
| false, | ||
| false, | ||
| "invalid value for --delete-uploaded: value must be \"yes\" or \"no\"", | ||
| "", | ||
| }, |
There was a problem hiding this comment.
@orgrim I've added these two tests.
I'm not sure of the quality of my implementation.
Does it suit you?
See https://github.com/orgrim/pg_back/pull/143/files#r2059869288 |
|
Merged. Thanks a lot for the contribution. |
Some users don't see any interest in consuming disk space on the server where pg_back is running when the archives have been saved remotely, for example on a secure Object Storage service.
This option allows to delete these intermediate files.
I chose the name --delete-local-file-after-upload for this parameter, but I am entirely open to modifying it if you have a more explicit suggestion, one that better conforms to the project's naming conventions, or that better describes its function.
From my perspective, it would make sense to enable this option by default when the upload functionality is activated. However, to avoid any breaking changes in behavior that might disrupt existing users, I preferred to set this option to false by default.