Add 'ephemeral' config option

This commit is contained in:
Joscha 2022-08-25 22:15:43 +02:00
parent d61e0ceab7
commit 84ff1f068b
3 changed files with 11 additions and 3 deletions

View file

@ -16,6 +16,7 @@ Procedure when bumping the version number:
### Added
- Config file
- `ephemeral` config option
## v0.3.0 - 2022-08-22

View file

@ -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 {

View file

@ -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