Skip to main content

chamber_vault/
config.rs

1use serde::{Deserialize, Serialize};
2use std::path::PathBuf;
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct BackupConfig {
6    /// Enable/disable automatic backups
7    pub enabled: bool,
8
9    /// Backup directory path
10    pub backup_dir: PathBuf,
11
12    /// Backup interval (in hours)
13    pub interval_hours: u64,
14
15    /// Maximum number of backups to retain
16    pub max_backups: usize,
17
18    /// Backup format (json, csv, backup)
19    pub format: String,
20
21    /// Compress backups
22    pub compress: bool,
23
24    /// Verify backup after creation
25    pub verify_after_backup: bool,
26}
27
28impl Default for BackupConfig {
29    fn default() -> Self {
30        Self {
31            enabled: false,
32            backup_dir: dirs::config_dir()
33                .unwrap_or_else(|| PathBuf::from("."))
34                .join("chamber")
35                .join("backups"),
36            interval_hours: 24, // Daily backups
37            max_backups: 7,     // Keep 7 backups
38            format: "backup".to_string(),
39            compress: true,
40            verify_after_backup: true,
41        }
42    }
43}