default vault name is dirname

feat/vaults
Tomáš Mládek 2021-12-19 18:53:10 +01:00
parent e2331981d0
commit c44afd0376
1 changed files with 13 additions and 1 deletions

View File

@ -97,7 +97,19 @@ fn main() -> Result<()> {
info!("Starting server at: {}", &bind);
let state = routes::State {
vault_name: matches.value_of("VAULT_NAME").map(|s| s.to_string()),
vault_name: Some(
matches
.value_of("VAULT_NAME")
.map(|s| s.to_string())
.unwrap_or_else(|| {
vault_path
.iter()
.last()
.unwrap()
.to_string_lossy()
.into_owned()
}),
),
directory: vault_path.clone(),
db_pool: db_pool.clone(),
job_container: job_container.clone(),