-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backend)!: Add backend to config and use rustic_backend
#977
base: main
Are you sure you want to change the base?
Conversation
@@ -63,6 +64,7 @@ log = { workspace = true } | |||
# serialization | |||
serde = { workspace = true } | |||
serde_json = { workspace = true } | |||
serde_path_to_error = { workspace = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Nice, but didn't really get it to work, could be nice for user facing errors though regarding misconfiguration.
@@ -115,6 +122,8 @@ anyhow = "1" | |||
serde = { version = "1", features = ["serde_derive"] } | |||
serde_with = { version = "3.4", features = ["base64"] } | |||
serde_json = "1" | |||
serde_path_to_error = "0.1.14" | |||
toml_edit = { version = "0.21.0", features = ["serde"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: remove, we have toml
and toml_edit
here, we only need the high-level crate (toml) for what we currently do.
69e1941
to
199b6f0
Compare
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com> refactor: commands now use the new backend struct from rustic_backend Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com> refactor: change config files and implement test to parse all config files with new settings for rustic_backend Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com> fix: typo Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com> style: dprint fmt Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com> testing: use result Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
199b6f0
to
1683847
Compare
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
config/copy_example.toml
Outdated
[[copy]] | ||
# Second copy target | ||
[copy.options] | ||
password-file = "/root/key-rustic-ovh" | ||
cache-dir = "/var/lib/cache/rustic" # explicitly specify cache dir for remote repository | ||
|
||
[copy.backend] | ||
repository = "rclone|ovh:backup" | ||
repo-hot = "rclone|ovh:backup-hot" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aawsome I think the naming is a bit off now, so we need to check what is best.
copy.options
is essentially copy.repository.options
.
Also it may be confusing to have [[copy]]
twice, which is the right thing IMHO, because it is an array of backends in the ends, but maybe we can find a different approach, now that we may need to have a breaking change in the config?
config/full.toml
Outdated
# Repository options: These options define which backend to use and which password to use. | ||
[repository] | ||
# Backend options: These options define which backend to use. | ||
[backend] | ||
repository = "/repo/rustic" # Must be set | ||
repo-hot = "/my/hot/repo" # Default: not set | ||
# one of the three password options must be set | ||
|
||
# Additional backend options - depending on backend. These can be only set in the config file. | ||
[backend.options] | ||
post-create-command = "par2create -qq -n1 -r5 %file" # Only local backend; Default: not set | ||
post-delete-command = "sh -c \"rm -f %file*.par2\"" # Only local backend; Default: not set | ||
retry = "default" # Only rest/rclone backend; Allowed values: "false"/"off", "default" or number of retries | ||
timeout = "10min" # Only rest/rclone backend | ||
|
||
# Repository options: These options define which repository settings and passwords to use. | ||
[repository] | ||
# Optional, but one of the three password options must be set | ||
# either on CLI, in the config file or in environment variables | ||
password = "mySecretPassword" | ||
password-file = "/my/password.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't really like the differentiation now:
[backend]
repository = ""
repo-hot = ""
[backend.options]
[repository]
Maybe we find some better naming there which makes it more clear?
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
config/simple.toml
Outdated
# Backend options: These options define which backend to use. | ||
[backend] | ||
repository = "/tmp/repo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Backend options: These options define which backend to use. | |
[backend] | |
repository = "/tmp/repo" | |
# Storage options: These options define which backend to use. | |
[storage] | |
provider = local | |
path = "/tmp/repo" |
BREAKING CHANGE:
TODO:
copy
in a good way