config

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Exist Is config file exist
	Exist bool
	// Models configs
	Models []ModelConfig
	// gobackup base dir
	GoBackupDir string = getGoBackupDir()
)

Functions

func Init

func Init(configFile string)

loadConfig from: - ./gobackup.yml - ~/.gobackup/gobackup.yml - /etc/gobackup/gobackup.yml

Types

type ModelConfig

type ModelConfig struct {
	Name         string
	TempPath     string
	DumpPath     string
	Schedule     ScheduleConfig
	CompressWith SubConfig
	EncryptWith  SubConfig
	Archive      *viper.Viper
	Splitter     *viper.Viper
	Databases    map[string]SubConfig
	Storages     map[string]SubConfig
	Notifiers    map[string]SubConfig
	Viper        *viper.Viper
}

ModelConfig for special case

func GetModelConfigByName

func GetModelConfigByName(name string) (model *ModelConfig)

GetModelConfigByName get model config by name

func (*ModelConfig) GetDatabaseByName

func (model *ModelConfig) GetDatabaseByName(name string) (subConfig *SubConfig)

GetDatabaseByName get database config by name

type ScheduleConfig

type ScheduleConfig struct {
	Enabled bool
	// Cron expression
	Cron string
	// Every
	Every string
	// At time
	At string
}

func (ScheduleConfig) String

func (sc ScheduleConfig) String() string

type SubConfig

type SubConfig struct {
	Name  string
	Type  string
	Viper *viper.Viper
}

SubConfig sub config info

Jump to

Keyboard shortcuts

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