pub mod metadata_files {
pub const SOURCE: &str = ".source.baker.yml";
pub const ARCHIVES: &str = ".archives.metadata.baker.yml";
pub const TIMESTAMP: &str = ".baker-timestamp.yml";
}
pub const ARCHIVE_EXTENSION: &str = ".tar.zst";
pub const BAKER_VERSION: &str = "1.0.0";
pub mod zstd {
pub const MIN_LEVEL: i32 = 1;
pub const MAX_LEVEL: i32 = 22;
}
pub mod paths {
pub const AWS_CREDENTIALS: &str = "~/.aws/credentials";
pub const DEFAULT_CONFIG: &str = "~/.config/bkr/config.yml";
pub const CONFIG_SEARCH: &[&str] = &[
"~/.config/bkr/config.yml", "~/.config/bkr/backup.conf.yml",
"./backup.conf.yml",
"./config.yml",
];
pub const RESTORE_TEMPLATE: &str = "~/.backups";
}
pub const SYSTEM_IGNORE_FILES: &[&str] = &[".DS_Store", "Thumbs.db", "desktop.ini"];
pub const METADATA_IGNORE_PATTERNS: &[&str] = &["**/.baker-*.yml", "**/*.baker.yml"];
pub mod content_types {
pub const OCTET_STREAM: &str = "application/octet-stream";
pub const YAML: &str = "application/x-yaml";
}
pub mod ui {
pub const SEPARATOR_WIDTH: usize = 60;
}
pub mod defaults {
pub const AWS_REGION: &str = "us-east-1";
pub const ZSTD_LEVEL: i32 = 3;
pub const BACKUP_AGE_WARNING_DAYS: i64 = 7;
pub const TIMEZONE: &str = "America/Los_Angeles";
}
pub mod time {
pub const SECONDS_PER_MINUTE: u64 = 60;
pub const SECONDS_PER_HOUR: u64 = 3600;
pub const SECONDS_PER_DAY: u64 = 86400;
pub const MS_PER_DAY: u64 = 1000 * 60 * 60 * 24;
}
pub mod windows_tasks {
pub const BACKUP: &str = "BakerBackup";
pub const RESTORE: &str = "BakerRestore";
}
pub const CONFIG_TEMPLATE: &str = r#"# bkr configuration file
# Documentation: https://github.com/goodwokdev/flow-bkr
storage:
profile: default # AWS profile name (~/.aws/credentials)
region: us-west-2 # AWS region
bucket:
name: my-backup-bucket # S3 bucket name
prefix: my-workstation # Optional prefix for all backups
restore:
path: ~/.backups # Where to restore files
bucket_prefix: "" # Restore from bucket root (or specific prefix)
to_backup:
# Example: backup your dotfiles
dotfiles:
path: ~/.config
destination_prefix: config
ignore:
- "*.log"
- "cache/"
- "Cache/"
# Example: backup a project with compression
# my-project:
# path: ~/projects/app
# destination_prefix: projects
# ignore:
# - ".git"
# - "target/"
# zstd: # Directories to compress as .tar.zst
# - node_modules
# - dist
# zstd_level: 3 # Compression level (1-22, default: 3)
daemon_schedule:
every: 1h # Backup interval (e.g., 30m, 1h, 6h, 1d)
exercise_restore: false # Also run restore on schedule
"#;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BackupStatus {
Success,
Failed,
}
impl BackupStatus {
pub fn as_str(&self) -> &'static str {
match self {
BackupStatus::Success => "success",
BackupStatus::Failed => "failed",
}
}
}