Skip to content

Commit

Permalink
Added webadmin.auto-update option for auto-updating Webadmin (closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Nov 10, 2024
1 parent 5a6b191 commit 8269023
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 14 additions & 0 deletions crates/common/src/manager/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 6 additions & 2 deletions crates/common/src/manager/webadmin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
Expand Down

0 comments on commit 8269023

Please sign in to comment.