Skip to content
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

fix(config)!: use multiple options only as array in config profile #1240

Merged
merged 9 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
214 changes: 126 additions & 88 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ rustdoc-args = ["--document-private-items", "--generate-link-to-definition"]

[dependencies]
abscissa_core = { version = "0.7.0", default-features = false, features = ["application"] }
rustic_backend = { version = "0.2.1", features = ["cli"] }
rustic_core = { version = "0.3.1", features = ["cli"] }
rustic_backend = { git = "https://github.com/rustic-rs/rustic_core.git", version = "0.2.1", features = ["cli"] }
rustic_core = { git = "https://github.com/rustic-rs/rustic_core.git", version = "0.3.1", features = ["cli"] }

# allocators
jemallocator-global = { version = "0.3.2", optional = true }
Expand Down
157 changes: 0 additions & 157 deletions config/full-one.toml

This file was deleted.

40 changes: 20 additions & 20 deletions config/full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Global options: These options are used for all commands.
[global]
use-profile = []
use-profiles = []
log-level = "info" # any of "off", "error", "warn", "info", "debug", "trace"; default: "info"
log-file = "/path/to/rustic.log" # Default: not set
no-progress = false
Expand All @@ -34,7 +34,7 @@ no-cache = false
cache-dir = "/my/rustic/cachedir" # Default: Applications default cache dir, e.g. ~/.cache/rustic
# use either warm-up (warm-up by file access) or warm-up-command to specify warming up
warm-up = false
warm-up-command = ["warmup.sh", "%id"] # Default: not set
warm-up-command = "warmup.sh %id" # Default: not set
warm-up-wait = "10min" # Default: not set

# Additional repository options - depending on backend. These can be only set in the config file or using env variables.
Expand Down Expand Up @@ -67,17 +67,17 @@ throttle = "10kB,10MB" # limit and burst per second; only opendal backends; Defa

# Snapshot-filter options: These options apply to all commands that use snapshot filters
[snapshot-filter]
filter-host = ["host2", "host2"] # Default: no host filter
filter-label = ["label1", "label2"] # Default: no label filter
filter-tags = ["tag1,tag2", "tag3"] # Default: no tags filger
filter-paths = ["path1", "path2,path3"] # Default: no paths filter
filter-hosts = ["host2", "host2"] # Default: []
filter-labels = ["label1", "label2"] # Default: []
filter-tags = ["tag1,tag2", "tag3"] # Default: []
filter-paths = ["path1", "path2,path3"] # Default: []
filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function

# Backup options: These options are used for all sources when calling the backup command.
# They can be overwritten by source-specific options (see below) or command line options.
[backup]
label = "label" # Default: not set
tag = ["tag1", "tag2"]
tags = ["tag1", "tag2"]
description = "my description" # Default: not set
description-from = "/path/to/description.txt" # Default: not set
delete-never = false
Expand All @@ -92,14 +92,14 @@ stdin-filename = "stdin" # Only for stdin source
as-path = "/my/path" # Default: not set; Note: This only works if source contains of a single path.
with-atime = false
ignore-devid = false
glob = []
iglob = []
glob-file = []
iglob-file = []
globs = []
iglobs = []
glob-files = []
iglob-files = []
git-ignore = false
no-require-git = false
exclude-if-present = [".nobackup", "CACHEDIR.TAG"] # Default: not set
custom-ignorefile = [".rusticignore", ".backupignore"] # Default: not set
custom-ignorefiles = [".rusticignore", ".backupignore"] # Default: not set
one-file-system = false
exclude-larger-than = "100MB" # Default: not set
json = false
Expand All @@ -109,13 +109,13 @@ quiet = false
skip-identical-parent = false

# Backup options for specific sources - all above options are also available here and replace them for the given source
[[backup.sources]]
source = "/path/to/source1"
[[backup.snapshots]]
sources = ["/path/to/source1"]
label = "label" # Default: not set
# .. and so on. see [backup]

[[backup.sources]]
source = [
[[backup.snapshots]]
sources = [
"/path/to/source2",
"/second/path",
] # multiple local paths are given as array
Expand All @@ -126,10 +126,10 @@ source = [
prune = false
group-by = "host,label,paths" # Can be any combination of host,label,paths,tags
# The following filter options can be also defined here and then overwrite the options for the forget command
filter-host = ["host2", "host2"] # Default: no host filter
filter-label = ["label1", "label2"] # Default: no label filter
filter-tags = ["tag1,tag2", "tag3"] # Default: no tags filger
filter-paths = ["path1", "path2,path3"] # Default: no paths filter
filter-hosts = ["host2", "host2"] # Default: []
filter-labels = ["label1", "label2"] # Default: []
filter-tags = ["tag1,tag2", "tag3"] # Default: []
filter-paths = ["path1", "path2,path3"] # Default: []
filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function
# The retention options follow. All of these are not set by default.
keep-tags = ["tag1", "tag2,tag3"] # Default: not set
Expand Down
14 changes: 7 additions & 7 deletions config/local.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ keep-yearly = 10

[backup]
exclude-if-present = [".nobackup", "CACHEDIR.TAG"]
glob-file = ["/root/rustic-local.glob"]
glob-files = ["/root/rustic-local.glob"]
one-file-system = true

[[backup.sources]]
source = "/home"
[[backup.snapshots]]
sources = ["/home"]
git-ignore = true

[[backup.sources]]
source = "/etc"
[[backup.snapshots]]
sources = ["/etc"]

[[backup.sources]]
source = "/root"
[[backup.snapshots]]
sources = ["/root"]
14 changes: 7 additions & 7 deletions config/rustic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ password = "mySecretPassword"

# snapshot-filter options: These options apply to all commands that use snapshot filters
[snapshot-filter]
filter-host = ["myhost"]
filter-hosts = ["myhost"]

# backup options: These options are used for all sources when calling the backup command.
# They can be overwritten by source-specific options (see below) or command line options.
Expand All @@ -29,16 +29,16 @@ git-ignore = true
#
# Note that if you call "rustic backup" without any source, all sources from this config
# file will be processed.
[[backup.sources]]
source = "/data/dir"
[[backup.snapshots]]
sources = ["/data/dir"]

[[backup.sources]]
source = "/home"
glob = ["!/home/*/Downloads/*"]
[[backup.snapshots]]
sources = ["/home"]
globs = ["!/home/*/Downloads/*"]

# forget options
[forget]
filter-host = [
filter-hosts = [
"forgethost",
] # <- this overwrites the snapshot-filter option defined above
keep-tags = ["mytag"]
Expand Down
14 changes: 7 additions & 7 deletions config/services/rclone_ovh-hot-cold.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ keep-yearly = 10

[backup]
exclude-if-present = [".nobackup", "CACHEDIR.TAG"]
glob-file = ["/root/rustic-ovh.glob"]
glob-files = ["/root/rustic-ovh.glob"]
one-file-system = true

[[backup.sources]]
source = "/home"
[[backup.snapshots]]
sources = ["/home"]
git-ignore = true

[[backup.sources]]
source = "/etc"
[[backup.snapshots]]
sources = ["/etc"]

[[backup.sources]]
source = "/root"
[[backup.snapshots]]
sources = ["/root"]
4 changes: 2 additions & 2 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ impl Configurable<RusticConfig> for EntryPoint {
let mut merge_logs = Vec::new();

// get global options from command line / env and config file
if config.global.use_profile.is_empty() {
if config.global.use_profiles.is_empty() {
config.merge_profile("rustic", &mut merge_logs, Level::Info)?;
} else {
for profile in &config.global.use_profile.clone() {
for profile in &config.global.use_profiles.clone() {
config.merge_profile(profile, &mut merge_logs, Level::Warn)?;
}
}
Expand Down
Loading
Loading