main: add LOHR_CONFIG variable

This commit is contained in:
Bruno BELANYI 2021-03-30 18:46:14 +00:00
parent d38e4556e1
commit 6f63b4c95c

View file

@ -52,6 +52,9 @@ fn repo_updater(rx: Receiver<Job>, homedir: PathBuf, config: GlobalSettings) {
fn parse_config(mut path: PathBuf) -> anyhow::Result<GlobalSettings> { fn parse_config(mut path: PathBuf) -> anyhow::Result<GlobalSettings> {
path.push("lohr-config"); path.push("lohr-config");
path.set_extension("yaml"); path.set_extension("yaml");
let path = env::var("LOHR_CONFIG")
.map(Into::into)
.unwrap_or_else(|_| path);
let config = if let Ok(file) = File::open(path.as_path()) { let config = if let Ok(file) = File::open(path.as_path()) {
serde_yaml::from_reader(file)? serde_yaml::from_reader(file)?
} else { } else {