backup

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableGitEncryption added in v1.3.0

func EnableGitEncryption(repoPath string, executable string) error

EnableGitEncryption configures the backup git repository to use filters to automatically encrypt any committed backups, using sibylgo as the provider for encryption and decryption.

func SyncToRemote added in v1.3.0

func SyncToRemote(backupCfg *util.Config, files *util.FileConfig) error

SyncToRemote pushes the backup to the remote location defined in the backup configuration.

Types

type AnsibleCryptor added in v1.3.0

type AnsibleCryptor struct {
	Password string
}

AnsibleCryptor uses the same mechanism as Ansible Vaults to encrypt backup content using a user-provided password.

func (*AnsibleCryptor) DecryptContent added in v1.3.0

func (c *AnsibleCryptor) DecryptContent(in io.Reader, out io.Writer) error

DecryptContent decrypts the backup content using Ansible Vault style encryption with the user-provided password.

func (*AnsibleCryptor) EncryptContent added in v1.3.0

func (c *AnsibleCryptor) EncryptContent(in io.Reader, out io.Writer) error

EncryptContent encrypts the backup content using Ansible Vault style encryption with the user-provided password.

type Backup

type Backup struct {
	Identifier string
	Timestamp  time.Time
	Message    string
}

Backup denotes a specific backup of the todofile. It doesn't contain the content, but acts as a reference for restoring.

func CheckAndMakeDailyBackup

func CheckAndMakeDailyBackup(files *util.FileConfig) (*Backup, error)

CheckAndMakeDailyBackup creates a daily backup of the todofile if there isn't one already for today.

func ListBackups

func ListBackups(todoDir string) ([]*Backup, error)

ListBackups lists all backups saved for the todoFile. They are ordered from newest to oldest backup.

func Restore

func Restore(files *util.FileConfig, restoreTo *Backup) (*Backup, error)

Restore restores the todoFile to the passed backup and creates a new backup for this restored state. It does not delete any of the intermediate backups that were reverted, so it's still possible to restore a different state.

func Save

func Save(files *util.FileConfig, message string) (*Backup, error)

Save creates a new backup of the todo file

type Cryptor added in v1.3.0

type Cryptor interface {
	EncryptContent(in io.Reader, out io.Writer) error
	DecryptContent(in io.Reader, out io.Writer) error
}

Cryptor provides methods to encrypt and decrypt backup content.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL