mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2024-11-24 06:19:46 +00:00
Added webadmin.auto-update option for auto-updating Webadmin (closes #842)
This commit is contained in:
parent
5a6b191bd4
commit
8269023431
2 changed files with 20 additions and 2 deletions
|
@ -345,6 +345,20 @@ impl BootManager {
|
|||
Version = env!("CARGO_PKG_VERSION"),
|
||||
);
|
||||
|
||||
// Webadmin auto-update
|
||||
if config
|
||||
.property_or_default::<bool>("webadmin.auto-update", "false")
|
||||
.unwrap_or_default()
|
||||
{
|
||||
if let Err(err) = data.webadmin.update(&core).await {
|
||||
trc::event!(
|
||||
Resource(trc::ResourceEvent::Error),
|
||||
Details = "Failed to update webadmin",
|
||||
CausedBy = err
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Build shared inner
|
||||
let (ipc, ipc_rxs) = build_ipc();
|
||||
let inner = Arc::new(Inner {
|
||||
|
|
|
@ -143,7 +143,7 @@ impl WebAdminManager {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn update_and_unpack(&self, core: &Core) -> trc::Result<()> {
|
||||
pub async fn update(&self, core: &Core) -> trc::Result<()> {
|
||||
let bytes = core
|
||||
.storage
|
||||
.config
|
||||
|
@ -155,7 +155,11 @@ impl WebAdminManager {
|
|||
.reason(err)
|
||||
.details("Failed to download webadmin")
|
||||
})?;
|
||||
core.storage.blob.put_blob(WEBADMIN_KEY, &bytes).await?;
|
||||
core.storage.blob.put_blob(WEBADMIN_KEY, &bytes).await
|
||||
}
|
||||
|
||||
pub async fn update_and_unpack(&self, core: &Core) -> trc::Result<()> {
|
||||
self.update(core).await?;
|
||||
self.unpack(&core.storage.blob).await
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue