return version info in /api/info

feat/vaults
Tomáš Mládek 2021-06-18 18:28:18 +02:00
parent 990f1e07e0
commit 9c71eea8e1
1 changed files with 4 additions and 1 deletions

View File

@ -19,6 +19,8 @@ use std::convert::TryFrom;
use std::path::PathBuf;
use std::sync::{Arc, RwLock};
const VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Clone)]
pub struct State {
pub vault_name: Option<String>,
@ -214,6 +216,7 @@ pub async fn get_jobs(state: web::Data<State>) -> Result<HttpResponse, Error> {
pub async fn get_info(state: web::Data<State>) -> Result<HttpResponse, Error> {
Ok(HttpResponse::Ok().json(json!({
"name": state.vault_name,
"location": state.directory
"location": state.directory,
"version": VERSION
})))
}