diff --git a/plume-models/src/lib.rs b/plume-models/src/lib.rs index a3d10755..f5009adc 100755 --- a/plume-models/src/lib.rs +++ b/plume-models/src/lib.rs @@ -17,6 +17,8 @@ extern crate serde_json; #[macro_use] extern crate tantivy; +use db_conn::DbPool; +use instance::Instance; use once_cell::sync::Lazy; use plume_common::activity_pub::inbox::InboxError; use posts::PostEvent; @@ -295,6 +297,15 @@ pub fn ap_url(url: &str) -> String { format!("https://{}", url) } +pub fn migrate_data(dbpool: &DbPool) -> Result<()> { + ensure_local_instance_keys(&dbpool.get().unwrap()) +} + +fn ensure_local_instance_keys(conn: &Connection) -> Result<()> { + let instance = Instance::get_local()?; + instance.set_keypair(conn) +} + #[cfg(test)] #[macro_use] mod tests {