mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-11 23:06:54 +00:00
db-snapshot: allow to set directory where snapshots are stored
Fix #926
This commit is contained in:
@@ -41,8 +41,14 @@ pub fn snapshot_metadata(garage: &Garage) -> Result<(), Error> {
|
||||
}
|
||||
};
|
||||
|
||||
let mut snapshots_dir = garage.config.metadata_dir.clone();
|
||||
snapshots_dir.push("snapshots");
|
||||
let snapshots_dir = match &garage.config.metadata_snapshots_dir {
|
||||
Some(d) => d.clone(),
|
||||
None => {
|
||||
let mut default_snapshots_dir = garage.config.metadata_dir.clone();
|
||||
default_snapshots_dir.push("snapshots");
|
||||
default_snapshots_dir
|
||||
}
|
||||
};
|
||||
fs::create_dir_all(&snapshots_dir)?;
|
||||
|
||||
let mut new_path = snapshots_dir.clone();
|
||||
|
||||
@@ -31,6 +31,9 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub use_local_tz: bool,
|
||||
|
||||
/// Optional directory where metadata snapshots will be store
|
||||
pub metadata_snapshots_dir: Option<PathBuf>,
|
||||
|
||||
/// Automatic snapshot interval for metadata
|
||||
#[serde(default)]
|
||||
pub metadata_auto_snapshot_interval: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user