Documentation ¶
Index ¶
- func DefaultBaseConfigDir() (out string, err error)
- func EncodeTOML(w io.Writer, in any) error
- func Init(inConfigDir string) (configDir string, err error)
- type Datastore
- type Defaults
- type Destination
- type Flag
- type Params
- type PasswordConfig
- type ResticBackup
- type ResticCheck
- type ResticDefaults
- type ResticGlobal
- type ResticLS
- type ResticSnapshots
- type ResticStats
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultBaseConfigDir ¶
DefaultBaseConfigDir returns the local file system path to find configuration and data files specific to the application. It's based on the XDG base directory spec for the host system.
func EncodeTOML ¶
EncodeTOML formats in to TOML and writes to w.
Types ¶
type Datastore ¶
type Datastore struct { // Defaults are any configuration values specific to the Datastore. // Unspecified fields will be merged in from top-level Defaults. Defaults Defaults `toml:"defaults"` Sources []Source `toml:"sources"` Destinations map[string]Destination `toml:"destinations"` // Name is not specified in the config file, but is implied by the // Datastore's place in the config data. The intention is to ease // maintenance of the configuration file. Name string `toml:"-"` // contains filtered or unexported fields }
Datastore is an abstraction for source paths to backup and the destination restic repositories.
func SelectDatastores ¶
SelectDatastores filters for Datastores with an exactly-matching Name in names, or have a Destination exactly matching one in destNames. If names is length 0, then the name of the Datastore is not considered. If destNames is length 0, then the name of the Destination is not considered either.
type Defaults ¶
type Defaults struct { PasswordConfig *PasswordConfig `toml:"password-config"` Restic *ResticDefaults `toml:"restic"` }
Defaults defines configuration values.
type Destination ¶
type Destination struct { // Name is not specified in the config file, but is implied by the // Destination's place in the config data. The intention is to ease // maintenance of the configuration file. Name string `toml:"-"` // Defaults are any configuration values specific to the Destination. // Unspecified fields will be merged in from the Datastore. Defaults Defaults `toml:"defaults"` // Path is the restic repository path. Path string `toml:"path"` // contains filtered or unexported fields }
Destination is a restic repository.
func (*Destination) BuildFlags ¶
func (d *Destination) BuildFlags(configDir string, subcmd string) ([]Flag, error)
BuildFlags merges in default config values and outputs a list of tuples representing the merged config.
func (*Destination) Merge ¶
func (d *Destination) Merge() (out Defaults, err error)
Merge combines the Defaults from the config file's top-level Defaults into the Datastore's Defaults, and then combines that into the Destination's Defaults. Any config values specified for the Destination are not overridden by the same config value specified in the Datastore.
type Params ¶
type Params struct { Defaults Defaults `toml:"defaults"` Datastores map[string]Datastore `toml:"datastores"` }
Params represents the entire config file after it's parsed.
type PasswordConfig ¶
type PasswordConfig struct { // Template is the password-command (a restic flag) to run. It is parsed by // package text/template from the golang standard library. Arguments may be // interjected into placeholders delimited by "{{" and "}}". Template *string `toml:"template"` // Args are positional arguments that may be referenced by placeholders in a // template string. Args []string `toml:"args"` }
PasswordConfig is a specialized configuration type to manage the password-command flag for restic subcommands.
type ResticBackup ¶
type ResticBackup struct { DryRun *bool `toml:"dry-run"` Exclude *[]string `toml:"exclude"` ExcludeCaches *bool `toml:"exclude-caches"` ExcludeFile *[]string `toml:"exclude-file"` ExcludeIfPresent *[]string `toml:"exclude-if-present"` ExcludeLargerThan *string `toml:"exclude-larger-than"` FilesFrom *[]string `toml:"files-from"` FilesFromRaw *[]string `toml:"files-from-raw"` FilesFromVerbatim *[]string `toml:"files-from-verbatim"` Force *bool `toml:"force"` Host *string `toml:"host"` Iexclude *[]string `toml:"iexclude"` IexcludeFile *[]string `toml:"iexclude-file"` IgnoreCtime *bool `toml:"ignore-ctime"` IgnoreInode *bool `toml:"ignore-inode"` OneFileSystem *bool `toml:"one-file-system"` Parent *string `toml:"parent"` Stdin *bool `toml:"stdin"` StdinFilename *string `toml:"stdin-filename"` Tag *[]string `toml:"tag"` Time *string `toml:"time"` // is type string because "now" is accepted by restic. WithAtime *bool `toml:"with-atime"` }
type ResticCheck ¶
type ResticDefaults ¶
type ResticDefaults struct { // Global refers to any restic flags that are made available for any restic // subcommand. In restic's usage menus, they may appear as "global flags". Global *ResticGlobal `toml:"global"` Backup *ResticBackup `toml:"backup"` Check *ResticCheck `toml:"check"` LS *ResticLS `toml:"ls"` Snapshots *ResticSnapshots `toml:"snapshots"` Stats *ResticStats `toml:"stats"` }
ResticDefaults are any default configuration values for restic subcommands. Asides from Global, which is configuration for shared flags, the struct fields here correspond to flags for a restic subcommand.
type ResticGlobal ¶
type ResticGlobal struct { CACert *string `toml:"cacert"` CacheDir *string `toml:"cache-dir"` CleanupCache *bool `toml:"cleanup-cache"` Compression *string `toml:"compression"` InsecureTLS *bool `toml:"insecure-tls"` JSON *bool `toml:"json"` KeyHint *string `toml:"key-hint"` LimitDownload *int `toml:"limit-download"` LimitUpload *int `toml:"limit-upload"` NoCache *bool `toml:"no-cache"` NoLock *bool `toml:"no-lock"` Option *[]map[string]string `toml:"option"` PackSize *uint `toml:"pack-size"` PasswordCommand *string `toml:"password-command"` PasswordFile *string `toml:"password-file"` Quiet *bool `toml:"quiet"` Repo *string `toml:"repo"` RepositoryFile *string `toml:"repository-file"` TLSClientCert *string `toml:"tls-client-cert"` Verbose *int `toml:"verbose"` }