diff --git a/README.md b/README.md index fce3337..13da9b8 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,19 @@ clock in or out, a new snapshot will be made. By default the backup repository is stored in `$HOME/.clocked_backups` and its password is saved in `$HOME/.clocked/backups.passwd` +If you want to keep your backups somewhere else (e.g. inside a Dropbox folder) +you have to do two things: + +1. Move `~/.clocked_backups` to its target location. +2. Inside `~/.clocked/config.yml` add the following line: + + ``` + backups_path: /Users/yourname/Dropbox/clocked_backups + ``` + + Replace `/Users/yourname/Dropbox/clocked_backups` with whatever path you + moved the backups to in step 1 🙂 + ## Command-line arguments - `--log-file ` specifies a path to a logfile clocked should diff --git a/cmd/clocked/main.go b/cmd/clocked/main.go index 8356731..7c1e7e4 100644 --- a/cmd/clocked/main.go +++ b/cmd/clocked/main.go @@ -65,7 +65,8 @@ func main() { } bk, err := backup.New(&backup.Options{ - SourcePath: storageFolder, + SourcePath: storageFolder, + RepositoryPath: cfg.BackupsPath, }) if err != nil { log.WithError(err).Fatal("Failed to configure backup") diff --git a/internal/backup/backup.go b/internal/backup/backup.go index 163a9f2..f908e1a 100644 --- a/internal/backup/backup.go +++ b/internal/backup/backup.go @@ -98,19 +98,13 @@ func (b *Backup) createEnv() []string { func (b *Backup) CreateSnapshot() error { cmd := exec.Command(b.resticPath, "backup", b.sourcePath) cmd.Env = b.createEnv() - if err := cmd.Run(); err != nil { - return err - } - return nil + return cmd.Run() } func (b *Backup) Restore(id string) error { cmd := exec.Command(b.resticPath, "restore", "--target", filepath.Dir(b.sourcePath), id) cmd.Env = b.createEnv() - if err := cmd.Run(); err != nil { - return err - } - return nil + return cmd.Run() } type ByTime []Snapshot diff --git a/internal/config/config.go b/internal/config/config.go index 59cab13..0a471ea 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,6 +8,7 @@ import ( ) type Config struct { + BackupsPath string `yaml:"backups_path"` JIRAUsername string `yaml:"jira_username"` JIRAURL string `yaml:"jira_url"` JIRAPassword string