diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-01-17 08:05:43 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-01-17 08:05:43 +0200 |
commit | 06b5606f13592b669212a97fb5ea3367d7f0fa21 (patch) | |
tree | c0c9080d79bf5cc9972b50a562e31ba822abbe05 /src/client.rs | |
parent | 6d53680f71d7d88bb9498c75db95bfb1408c6fc7 (diff) | |
download | obnam2-06b5606f13592b669212a97fb5ea3367d7f0fa21.tar.gz |
feat: add a default configuration file
The ~/.config/obnam/obnam.yaml file will be used as the configuration
file by default. The ~/.config directory can be overridden by setting
the XDG variable (XDG_CONFIG_HOME), or the whole file can be
overridden with the --config option to obnam.
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs index 4526830..23df540 100644 --- a/src/client.rs +++ b/src/client.rs @@ -9,6 +9,7 @@ use crate::fsentry::{FilesystemEntry, FilesystemKind}; use crate::generation::{FinishedGeneration, LocalGeneration}; use crate::genlist::GenerationList; +use anyhow::Context; use chrono::{DateTime, Local}; use log::{debug, error, info, trace}; use reqwest::blocking::Client; @@ -28,7 +29,8 @@ pub struct ClientConfig { impl ClientConfig { pub fn read_config(filename: &Path) -> anyhow::Result<Self> { trace!("read_config: filename={:?}", filename); - let config = std::fs::read_to_string(filename)?; + let config = std::fs::read_to_string(filename) + .with_context(|| format!("reading configuration file {}", filename.display()))?; let config = serde_yaml::from_str(&config)?; Ok(config) } |