Skip to content

Commit

Permalink
cleanup network keys on uninstall (#2484)
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bonez authored Oct 30, 2023
1 parent 765b542 commit 9e554bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions backend/src/install/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ where
);
cleanup(ctx, id, &version).await?;
cleanup_folder(volume_dir, Arc::new(dependents_paths)).await;
remove_tor_keys(secrets, id).await?;
remove_network_keys(secrets, id).await?;

ctx.db
.mutate(|d| {
Expand All @@ -188,12 +188,15 @@ where
}

#[instrument(skip_all)]
pub async fn remove_tor_keys<Ex>(secrets: &mut Ex, id: &PackageId) -> Result<(), Error>
pub async fn remove_network_keys<Ex>(secrets: &mut Ex, id: &PackageId) -> Result<(), Error>
where
for<'a> &'a mut Ex: Executor<'a, Database = Postgres>,
{
sqlx::query!("DELETE FROM network_keys WHERE package = $1", &*id)
.execute(&mut *secrets)
.await?;
sqlx::query!("DELETE FROM tor WHERE package = $1", &*id)
.execute(secrets)
.execute(&mut *secrets)
.await?;
Ok(())
}
Expand Down

0 comments on commit 9e554bd

Please sign in to comment.