563c9515d9
Major refactor of backup and storage paths: - Per-drive restic repos at <drive>/backups/primary/restic/ - Per-app DB dumps at <drive>/backups/primary/<app>/db-dumps/ - Remove global BackupDir, DBDumpDir, ResticRepo config fields - Add SystemDataPath config (fallback for apps without HDD) - New backup/paths.go with pure path computation helpers - Add GetStackHDDPath to StackDataProvider interface - Restic methods now accept repoPath as parameter - Cross-drive backup uses new secondary path structure - Rename storage/ to appdata/ in scripts and compose templates - Update protected HDD paths (storage → appdata + backups) - Simplify backup UI (remove global path displays) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package backup
|
|
|
|
import "path/filepath"
|
|
|
|
// PrimaryBackupPath returns the root primary backup directory for a drive.
|
|
func PrimaryBackupPath(drivePath string) string {
|
|
return filepath.Join(drivePath, "backups", "primary")
|
|
}
|
|
|
|
// PrimaryResticRepoPath returns the restic repo path on a drive's primary backup.
|
|
func PrimaryResticRepoPath(drivePath string) string {
|
|
return filepath.Join(drivePath, "backups", "primary", "restic")
|
|
}
|
|
|
|
// AppDBDumpPath returns the DB dump directory for an app on its home drive.
|
|
func AppDBDumpPath(drivePath, stackName string) string {
|
|
return filepath.Join(drivePath, "backups", "primary", stackName, "db-dumps")
|
|
}
|
|
|
|
// SecondaryBackupPath returns the root secondary backup directory for a drive.
|
|
func SecondaryBackupPath(drivePath string) string {
|
|
return filepath.Join(drivePath, "backups", "secondary")
|
|
}
|
|
|
|
// AppSecondaryRsyncPath returns the rsync destination for an app's secondary backup.
|
|
func AppSecondaryRsyncPath(drivePath, stackName string) string {
|
|
return filepath.Join(drivePath, "backups", "secondary", stackName, "rsync")
|
|
}
|
|
|
|
// SecondaryResticRepoPath returns the restic repo path on a drive's secondary backup.
|
|
func SecondaryResticRepoPath(drivePath string) string {
|
|
return filepath.Join(drivePath, "backups", "secondary", "restic")
|
|
}
|
|
|
|
// AppDataDir returns the app data directory path on a drive.
|
|
func AppDataDir(drivePath, stackName string) string {
|
|
return filepath.Join(drivePath, "appdata", stackName)
|
|
}
|