aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/src/lib.rs3
-rw-r--r--common/src/config.rs5
-rw-r--r--common/src/lib.rs1
-rw-r--r--import/src/main.rs1
4 files changed, 7 insertions, 3 deletions
diff --git a/base/src/lib.rs b/base/src/lib.rs
index f130a8c..c8b767d 100644
--- a/base/src/lib.rs
+++ b/base/src/lib.rs
@@ -4,8 +4,8 @@
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
#![feature(lazy_cell)]
-pub mod permission;
pub mod cache;
+pub mod permission;
use jellycommon::{config::GlobalConfig, AssetLocation};
use std::{fs::File, path::PathBuf, sync::LazyLock};
@@ -31,6 +31,7 @@ impl AssetLocationExt for AssetLocation {
AssetLocation::Assets(p) => CONF.asset_path.join(p),
AssetLocation::Cache(p) => CONF.cache_path.join(p),
AssetLocation::Library(p) => CONF.library_path.join(p),
+ AssetLocation::Temp(p) => CONF.temp_path.join(p),
}
}
}
diff --git a/common/src/config.rs b/common/src/config.rs
index a9e3e0e..aded4ff 100644
--- a/common/src/config.rs
+++ b/common/src/config.rs
@@ -4,11 +4,10 @@
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
+use crate::user::PermissionSet;
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, path::PathBuf};
-use crate::user::PermissionSet;
-
#[rustfmt::skip]
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct GlobalConfig {
@@ -17,6 +16,7 @@ pub struct GlobalConfig {
#[serde(default = "default::asset_path")] pub asset_path: PathBuf,
#[serde(default = "default::database_path")] pub database_path: PathBuf,
#[serde(default = "default::library_path")] pub library_path: PathBuf,
+ #[serde(default = "default::temp_path")] pub temp_path: PathBuf,
#[serde(default = "default::cache_path")] pub cache_path: PathBuf,
#[serde(default = "default::admin_username")] pub admin_username: String,
#[serde(default = "default::max_in_memory_cache_size")] pub max_in_memory_cache_size: usize,
@@ -38,5 +38,6 @@ mod default {
pub fn database_path() -> PathBuf { "data/database".into() }
pub fn library_path() -> PathBuf { "data/library".into() }
pub fn cache_path() -> PathBuf { "data/cache".into() }
+ pub fn temp_path() -> PathBuf { "/tmp".into() }
pub fn max_in_memory_cache_size() -> usize { 50_000_000 }
}
diff --git a/common/src/lib.rs b/common/src/lib.rs
index a7e1c3f..c425c21 100644
--- a/common/src/lib.rs
+++ b/common/src/lib.rs
@@ -62,6 +62,7 @@ pub enum AssetLocation {
Cache(PathBuf),
Library(PathBuf),
Assets(PathBuf),
+ Temp(PathBuf),
}
#[rustfmt::skip]
diff --git a/import/src/main.rs b/import/src/main.rs
index e04abe5..f017407 100644
--- a/import/src/main.rs
+++ b/import/src/main.rs
@@ -103,6 +103,7 @@ fn main() -> anyhow::Result<()> {
cache_path: path.join("cache"),
library_path: path.join("library"),
database_path: path.join("database"),
+ temp_path: "/tmp".into(),
cookie_key: Some(
base64::engine::general_purpose::STANDARD
.encode([(); 32].map(|_| random())),