diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-11-18 08:47:37 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-11-18 08:47:37 +0200 |
commit | b5ddc105852b63651916f322ce855baf61d129d0 (patch) | |
tree | d6e6ee6ca6f0ecfbba1311879e87e77a720a49c9 /src/client.rs | |
parent | 24ffcb0083750bb77963a1ab8e3205290c2c7190 (diff) | |
download | obnam2-b5ddc105852b63651916f322ce855baf61d129d0.tar.gz |
feat! change client config to take a base URL instead of host, port
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/client.rs b/src/client.rs index ecfc42c..d7dca36 100644 --- a/src/client.rs +++ b/src/client.rs @@ -13,8 +13,7 @@ use std::path::{Path, PathBuf}; #[derive(Debug, Deserialize, Clone)] pub struct ClientConfig { - pub server_name: String, - pub server_port: u16, + pub server_url: String, pub dbname: PathBuf, pub root: PathBuf, } @@ -46,12 +45,14 @@ pub struct BackupClient { } impl BackupClient { - pub fn new(host: &str, port: u16) -> anyhow::Result<Self> { + pub fn new(base_url: &str) -> anyhow::Result<Self> { let client = Client::builder() .danger_accept_invalid_certs(true) .build()?; - let base_url = format!("http://{}:{}/chunks", host, port,); - Ok(Self { client, base_url }) + Ok(Self { + client, + base_url: base_url.to_string(), + }) } pub fn upload_filesystem_entry( |