diff options
author | Baptiste Jonglez <git@bitsofnetworks.org> | 2025-01-24 19:21:08 +0100 |
---|---|---|
committer | Baptiste Jonglez <git@bitsofnetworks.org> | 2025-01-27 18:33:55 +0100 |
commit | 59c153d2804500b51362b20c3c8252383ef0e9ce (patch) | |
tree | d5ccb41f0ce403780a236dac04337c0eb82734fe /src/model/snapshot.rs | |
parent | 0156e40c9d8015b81f80f12f058564288fdb304c (diff) | |
download | garage-59c153d2804500b51362b20c3c8252383ef0e9ce.tar.gz garage-59c153d2804500b51362b20c3c8252383ef0e9ce.zip |
db-snapshot: allow to set directory where snapshots are stored
Fix #926
Diffstat (limited to 'src/model/snapshot.rs')
-rw-r--r-- | src/model/snapshot.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/model/snapshot.rs b/src/model/snapshot.rs index 87756f60..8e8995f9 100644 --- a/src/model/snapshot.rs +++ b/src/model/snapshot.rs @@ -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(); |