Can upload ISO files

This commit is contained in:
2023-09-05 13:19:25 +02:00
parent 83ccd3a4b9
commit 036595fb24
24 changed files with 671 additions and 36 deletions

View File

@ -1,4 +1,5 @@
use clap::Parser;
use std::path::{Path, PathBuf};
/// VirtWeb backend API
#[derive(Parser, Debug, Clone)]
@ -64,6 +65,10 @@ pub struct AppConfig {
#[arg(long, env, default_value = "APP_ORIGIN/oidc_cb")]
oidc_redirect_url: String,
/// Storage directory
#[arg(long, env, default_value = "storage")]
pub storage: String,
/// Directory where temporary files are stored
#[arg(long, env, default_value = "/tmp")]
pub temp_dir: String,
@ -131,6 +136,16 @@ impl AppConfig {
self.oidc_redirect_url
.replace("APP_ORIGIN", &self.website_origin)
}
/// Get root storage directory
pub fn storage_path(&self) -> PathBuf {
Path::new(&self.storage).canonicalize().unwrap()
}
/// Get iso storage directory
pub fn iso_storage_path(&self) -> PathBuf {
self.storage_path().join("iso")
}
}
#[derive(Debug, Clone, serde::Serialize)]