From 84ff1f068b985f74c711fc25d12481df81f6260f Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 25 Aug 2022 22:15:43 +0200 Subject: [PATCH] Add 'ephemeral' config option --- CHANGELOG.md | 1 + src/config.rs | 5 ++++- src/main.rs | 8 ++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2b12cb..7f148a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Procedure when bumping the version number: ### Added - Config file +- `ephemeral` config option ## v0.3.0 - 2022-08-22 diff --git a/src/config.rs b/src/config.rs index c973a3c..6faa9a5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,7 +6,10 @@ use serde::Deserialize; use crate::macros::ok_or_return; #[derive(Debug, Default, Deserialize)] -pub struct Config {} +pub struct Config { + #[serde(default)] + pub ephemeral: bool, +} impl Config { pub fn load(path: &Path) -> Self { diff --git a/src/main.rs b/src/main.rs index 2f341dc..1614e16 100644 --- a/src/main.rs +++ b/src/main.rs @@ -90,9 +90,13 @@ async fn main() -> anyhow::Result<()> { .config .unwrap_or_else(|| dirs.config_dir().join("config.toml")); println!("Config file: {}", config_path.to_string_lossy()); - let config = Config::load(&config_path); + let mut config = Config::load(&config_path); - let vault = if args.ephemeral { + if args.ephemeral { + config.ephemeral = true; + } + + let vault = if config.ephemeral { vault::launch_in_memory()? } else { let data_dir = args