config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasGroup

func HasGroup(groupKey string) bool

HasGroup returns true if the group of profiles exists in the configuration

func HasProfile

func HasProfile(profileKey string) bool

HasProfile returns true if the profile exists in the configuration

func LoadConfiguration

func LoadConfiguration(configFile string) error

func LoadGroup

func LoadGroup(groupKey string) ([]string, error)

LoadGroup returns the list of profiles in a group

func ProfileGroups

func ProfileGroups() map[string][]string

func ProfileKeys

func ProfileKeys() []string

func ProfileSections

func ProfileSections() map[string][]string

ProfileSections returns a list of profiles with all the sections defined inside each

func SaveAs

func SaveAs(filename string) error

Types

type BackupSection

type BackupSection struct {
	CheckBefore bool                   `mapstructure:"check-before"`
	CheckAfter  bool                   `mapstructure:"check-after"`
	RunBefore   []string               `mapstructure:"run-before"`
	RunAfter    []string               `mapstructure:"run-after"`
	UseStdin    bool                   `mapstructure:"stdin" argument:"stdin"`
	Source      []string               `mapstructure:"source"`
	ExcludeFile []string               `mapstructure:"exclude-file" argument:"exclude-file"`
	FilesFrom   []string               `mapstructure:"files-from" argument:"files-from"`
	OtherFlags  map[string]interface{} `mapstructure:",remain"`
}

type Global

type Global struct {
	IONice         bool   `mapstructure:"ionice"`
	IONiceClass    int    `mapstructure:"ionice-class"`
	IONiceLevel    int    `mapstructure:"ionice-level"`
	Nice           int    `mapstructure:"nice"`
	Priority       string `mapstructure:"priority"`
	DefaultCommand string `mapstructure:"default-command"`
	Initialize     bool   `mapstructure:"initialize"`
	ResticBinary   string `mapstructure:"restic-binary"`
}

func GetGlobalSection

func GetGlobalSection() (*Global, error)

type Profile

type Profile struct {
	Name          string
	Quiet         bool                   `mapstructure:"quiet" argument:"quiet"`
	Verbose       bool                   `mapstructure:"verbose" argument:"verbose"`
	Repository    string                 `mapstructure:"repository" argument:"repo"`
	PasswordFile  string                 `mapstructure:"password-file" argument:"password-file"`
	CacheDir      string                 `mapstructure:"cache-dir" argument:"cache-dir"`
	CACert        string                 `mapstructure:"cacert" argument:"cacert"`
	TLSClientCert string                 `mapstructure:"tls-client-cert" argument:"tls-client-cert"`
	Initialize    bool                   `mapstructure:"initialize"`
	Inherit       string                 `mapstructure:"inherit"`
	Lock          string                 `mapstructure:"lock"`
	Environment   map[string]string      `mapstructure:"env"`
	Backup        *BackupSection         `mapstructure:"backup"`
	Retention     *RetentionSection      `mapstructure:"retention"`
	Snapshots     map[string]interface{} `mapstructure:"snapshots"`
	Forget        map[string]interface{} `mapstructure:"forget"`
	Check         map[string]interface{} `mapstructure:"check"`
	Mount         map[string]interface{} `mapstructure:"mount"`
	OtherFlags    map[string]interface{} `mapstructure:",remain"`
}

func LoadProfile

func LoadProfile(profileKey string) (*Profile, error)

LoadProfile from configuration

func NewProfile

func NewProfile(name string) *Profile

NewProfile instantiates a new blank profile

func (*Profile) GetBackupSource

func (p *Profile) GetBackupSource() []string

GetBackupSource returns the directories to backup

func (*Profile) GetCommandFlags

func (p *Profile) GetCommandFlags(command string) map[string][]string

GetCommandFlags returns the flags specific to the command (backup, snapshots, etc.)

func (*Profile) GetCommonFlags

func (p *Profile) GetCommonFlags() map[string][]string

GetCommonFlags returns the flags common to all commands

func (*Profile) GetRetentionFlags

func (p *Profile) GetRetentionFlags() map[string][]string

GetRetentionFlags returns the flags specific to the "forget" command being run as part of a backup

func (*Profile) SetHost

func (p *Profile) SetHost(hostname string)

SetHost will replace any host value from a boolean to the hostname

func (*Profile) SetRootPath

func (p *Profile) SetRootPath(rootPath string)

SetRootPath changes the path of all the relative paths and files in the configuration

type RetentionSection

type RetentionSection struct {
	BeforeBackup bool                   `mapstructure:"before-backup"`
	AfterBackup  bool                   `mapstructure:"after-backup"`
	OtherFlags   map[string]interface{} `mapstructure:",remain"`
}

Jump to

Keyboard shortcuts

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