summaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-02-06 19:22:10 +0200
committerLars Wirzenius <liw@liw.fi>2021-02-06 20:00:04 +0200
commit7cfa4142bc1859f9084a35e7e7fd5f67d3a655a3 (patch)
tree1eabf91078c2be52b719b78110af1630a3fbf375 /src/client.rs
parentaa75f0d5709fb4062900db5ab5b6e2598b6af667 (diff)
downloadobnam2-7cfa4142bc1859f9084a35e7e7fd5f67d3a655a3.tar.gz
feat! back up multiple roots
This changes the client configuration file "root" field (with a single string) to "roots" (a list of strings).
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client.rs b/src/client.rs
index 7a4ce21..e4d9be8 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -25,7 +25,7 @@ struct TentativeClientConfig {
server_url: String,
verify_tls_cert: Option<bool>,
chunk_size: Option<usize>,
- root: PathBuf,
+ roots: Vec<PathBuf>,
log: Option<PathBuf>,
}
@@ -34,7 +34,7 @@ pub struct ClientConfig {
pub server_url: String,
pub verify_tls_cert: bool,
pub chunk_size: usize,
- pub root: PathBuf,
+ pub roots: Vec<PathBuf>,
pub log: PathBuf,
}
@@ -43,7 +43,7 @@ pub enum ClientConfigError {
#[error("server_url is empty")]
ServerUrlIsEmpty,
- #[error("backup root is unset or empty")]
+ #[error("No backup roots in config; at least one is needed")]
NoBackupRoot,
#[error("server URL doesn't use https: {0}")]
@@ -66,7 +66,7 @@ impl ClientConfig {
let config = ClientConfig {
server_url: tentative.server_url,
- root: tentative.root,
+ roots: tentative.roots,
verify_tls_cert: tentative.verify_tls_cert.or(Some(false)).unwrap(),
chunk_size: tentative.chunk_size.or(Some(DEFAULT_CHUNK_SIZE)).unwrap(),
log: tentative.log.or(Some(PathBuf::from(DEVNULL))).unwrap(),
@@ -83,7 +83,7 @@ impl ClientConfig {
if !self.server_url.starts_with("https://") {
return Err(ClientConfigError::NotHttps(self.server_url.to_string()));
}
- if self.root.to_string_lossy().is_empty() {
+ if self.roots.is_empty() {
return Err(ClientConfigError::NoBackupRoot);
}
Ok(())