Added webadmin.path config to override unpack directory (#792)
This commit is contained in:
@@ -69,7 +69,10 @@ impl Data {
|
|||||||
jmap_id_gen: id_generator.clone(),
|
jmap_id_gen: id_generator.clone(),
|
||||||
queue_id_gen: id_generator.clone(),
|
queue_id_gen: id_generator.clone(),
|
||||||
span_id_gen: id_generator,
|
span_id_gen: id_generator,
|
||||||
webadmin: WebAdminManager::new(),
|
webadmin: config
|
||||||
|
.value("webadmin.path")
|
||||||
|
.map(|path| WebAdminManager::new(path.into()))
|
||||||
|
.unwrap_or_default(),
|
||||||
config_version: 0.into(),
|
config_version: 0.into(),
|
||||||
jmap_limiter: DashMap::with_capacity_and_hasher_and_shard_amount(
|
jmap_limiter: DashMap::with_capacity_and_hasher_and_shard_amount(
|
||||||
capacity,
|
capacity,
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ impl<T> Resource<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl WebAdminManager {
|
impl WebAdminManager {
|
||||||
pub fn new() -> Self {
|
pub fn new(base_path: PathBuf) -> Self {
|
||||||
Self {
|
Self {
|
||||||
bundle_path: TempDir::new(),
|
bundle_path: TempDir::new(base_path),
|
||||||
routes: ArcSwap::from_pointee(Default::default()),
|
routes: ArcSwap::from_pointee(Default::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,9 +171,9 @@ pub struct TempDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TempDir {
|
impl TempDir {
|
||||||
pub fn new() -> TempDir {
|
pub fn new(path: PathBuf) -> TempDir {
|
||||||
TempDir {
|
TempDir {
|
||||||
path: std::env::temp_dir().join(std::str::from_utf8(WEBADMIN_KEY).unwrap()),
|
path: path.join(std::str::from_utf8(WEBADMIN_KEY).unwrap()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,13 +193,13 @@ fn unpack_error(err: std::io::Error) -> trc::Error {
|
|||||||
|
|
||||||
impl Default for WebAdminManager {
|
impl Default for WebAdminManager {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new(std::env::temp_dir())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TempDir {
|
impl Default for TempDir {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new(std::env::temp_dir())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user