Documentation
¶
Index ¶
Constants ¶
const DefaultResticPasswordEnvVar = "CODEBAK_RESTIC_PASSWORD"
DefaultResticPasswordEnvVar is the default environment variable for the restic password. #nosec G101 -- This is an env var name, not a credential
Variables ¶
var ErrNoHomeDir = fmt.Errorf("cannot determine home directory: HOME environment variable not set")
ErrNoHomeDir is returned when the home directory cannot be determined
Functions ¶
func ConfigPath ¶
func DefaultResticRepoPath ¶ added in v1.0.0
DefaultResticRepoPath returns the default restic repository path.
func DefaultSensitivePaths ¶ added in v1.0.0
func DefaultSensitivePaths() []string
DefaultSensitivePaths returns the default paths to back up with restic encryption. These are common dotfiles and config directories containing sensitive data.
func ExpandPath ¶
ExpandPath expands ~ to home directory. Returns error if path starts with ~ but home directory cannot be determined.
func IsValidSourceType ¶ added in v1.0.0
func IsValidSourceType(t SourceType) bool
IsValidSourceType checks if a source type is valid
Types ¶
type Config ¶
type Config struct {
// Deprecated: Use Sources instead. Kept for backwards compatibility.
SourceDir string `yaml:"source_dir,omitempty"`
Sources []Source `yaml:"sources,omitempty"`
// Individual projects outside source dirs (a la carte)
Projects []string `yaml:"projects,omitempty"`
BackupDir string `yaml:"backup_dir"`
Schedule string `yaml:"schedule"`
Time string `yaml:"time"`
Exclude []string `yaml:"exclude"`
Retention struct {
KeepLast int `yaml:"keep_last"`
} `yaml:"retention"`
// Restic configuration for sensitive path backups
Restic ResticConfig `yaml:"restic,omitempty"`
}
func DefaultConfig ¶
func (*Config) GetResticPassword ¶ added in v1.0.0
GetResticPassword retrieves the restic password from the configured environment variable. Returns an error if the environment variable is not set.
func (*Config) GetResticPasswordEnvVar ¶ added in v1.0.0
GetResticPasswordEnvVar returns the environment variable name for the restic password.
func (*Config) GetResticRepoPath ¶ added in v1.0.0
GetResticRepoPath returns the restic repository path with defaults applied.
func (*Config) GetSources ¶ added in v1.0.0
GetSources returns all sources, migrating from SourceDir if needed
func (*Config) GetSourcesByType ¶ added in v1.0.0
func (c *Config) GetSourcesByType(t SourceType) []Source
GetSourcesByType returns sources filtered by type
type ResticConfig ¶ added in v1.0.0
type ResticConfig struct {
// RepoPath is the path to the restic repository for sensitive backups.
// Defaults to ~/.codebak/restic-repo
RepoPath string `yaml:"repo_path,omitempty"`
// PasswordEnvVar is the environment variable name containing the repository password.
// Defaults to CODEBAK_RESTIC_PASSWORD
PasswordEnvVar string `yaml:"password_env_var,omitempty"`
}
ResticConfig holds configuration for restic encrypted backups.
type Source ¶ added in v1.0.0
type Source struct {
Path string `yaml:"path"`
Label string `yaml:"label,omitempty"` // Display label (defaults to path basename)
Icon string `yaml:"icon,omitempty"` // Emoji icon for TUI display
Type SourceType `yaml:"type,omitempty"` // Backup type: git (default) or sensitive
}
Source represents a directory to scan for projects
type SourceType ¶ added in v1.0.0
type SourceType string
SourceType defines how a source should be backed up
const ( // SourceTypeGit backs up using git bundles (default for code directories) SourceTypeGit SourceType = "git" // SourceTypeSensitive backs up using restic for encrypted incremental backups SourceTypeSensitive SourceType = "sensitive" )