Add dump support

This commit is contained in:
Mubelotix
2025-07-30 15:06:37 +02:00
parent 93f8b31eec
commit 064d9d5ff8
8 changed files with 66 additions and 20 deletions

View File

@ -8,6 +8,7 @@ use meilisearch_types::batches::Batch;
use meilisearch_types::features::{ChatCompletionSettings, Network, RuntimeTogglableFeatures};
use meilisearch_types::keys::Key;
use meilisearch_types::settings::{Checked, Settings};
use meilisearch_types::webhooks::Webhooks;
use serde_json::{Map, Value};
use tempfile::TempDir;
use time::OffsetDateTime;
@ -74,6 +75,16 @@ impl DumpWriter {
Ok(std::fs::write(self.dir.path().join("network.json"), serde_json::to_string(&network)?)?)
}
pub fn create_webhooks(&self, webhooks: Webhooks) -> Result<()> {
if webhooks == Webhooks::default() {
return Ok(());
}
Ok(std::fs::write(
self.dir.path().join("webhooks.json"),
serde_json::to_string(&webhooks)?,
)?)
}
pub fn persist_to(self, mut writer: impl Write) -> Result<()> {
let gz_encoder = GzEncoder::new(&mut writer, Compression::default());
let mut tar_encoder = tar::Builder::new(gz_encoder);