Add 'ephemeral' config option
This commit is contained in:
parent
d61e0ceab7
commit
84ff1f068b
3 changed files with 11 additions and 3 deletions
|
|
@ -16,6 +16,7 @@ Procedure when bumping the version number:
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Config file
|
- Config file
|
||||||
|
- `ephemeral` config option
|
||||||
|
|
||||||
## v0.3.0 - 2022-08-22
|
## v0.3.0 - 2022-08-22
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@ use serde::Deserialize;
|
||||||
use crate::macros::ok_or_return;
|
use crate::macros::ok_or_return;
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize)]
|
#[derive(Debug, Default, Deserialize)]
|
||||||
pub struct Config {}
|
pub struct Config {
|
||||||
|
#[serde(default)]
|
||||||
|
pub ephemeral: bool,
|
||||||
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn load(path: &Path) -> Self {
|
pub fn load(path: &Path) -> Self {
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,13 @@ async fn main() -> anyhow::Result<()> {
|
||||||
.config
|
.config
|
||||||
.unwrap_or_else(|| dirs.config_dir().join("config.toml"));
|
.unwrap_or_else(|| dirs.config_dir().join("config.toml"));
|
||||||
println!("Config file: {}", config_path.to_string_lossy());
|
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()?
|
vault::launch_in_memory()?
|
||||||
} else {
|
} else {
|
||||||
let data_dir = args
|
let data_dir = args
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue