New Feature: dynamically replacing files during packaging - #259
Open
MakeDecisionWorth wants to merge 2 commits into
Open
New Feature: dynamically replacing files during packaging#259MakeDecisionWorth wants to merge 2 commits into
MakeDecisionWorth wants to merge 2 commits into
Conversation
Allows a `path` backup-list entry to declare `replace: [{file, with}]`
pairs, substituting a stand-in file (e.g. an exported copy of a
locked database) for the original when zipping, while keeping the
original file name inside the archive.
Validates `file`/`with` against traversal and absolute paths, resolves
symlinks to ensure replacement sources stay within the backup location,
and skips replacements that would pull in the local backup storage
folder itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This feature only applies to Path-type backups (not Glob or single-file backups). It allows dynamically replacing files inside the zip archive during packaging.
One application on my server: using a custom-built Java agent to intercept the H2 database connection URL, then writing a plugin that listens for DriveBackupV2's backup events, connecting to the H2 database ahead of time to export the data. This works great for backing up databases used by plugins like LuckPerms, and avoids the issue on Windows where some local databases can't be backed up due to exclusive file locks. Of course, there's likely more to explore with this feature.
Usage:
Under
replace, each entry defines a pair: file is the path (relative to the backup source) of the file that would normally be included in the zip, and with is the path to the file that should be packaged in its place. Multiple pairs can be listed to replace several files in the same backup.