config

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DoesConfigFileExist bool
	// Models configs
	Models []ModelConfig
	// gobackup base dir
	GoBackupDir = getGoBackupDir()

	PidFilePath = filepath.Join(GoBackupDir, "gobackup.pid")
	LogFilePath = filepath.Join(GoBackupDir, "gobackup.log")
	Web         WebConfig
)

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
	Description string
	// WorkDir of the gobackup started
	WorkDir        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
	DefaultStorage string
	Notifiers      map[string]SubConfig
	Viper          *viper.Viper
}

ModelConfig for special case

func GetModelConfigByName

func GetModelConfigByName(name string) *ModelConfig

GetModelConfigByName get model config by name, nil if not found

func (*ModelConfig) GetDatabaseByName

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

GetDatabaseByName get database config by name, nil if not found

type ScheduleConfig

type ScheduleConfig struct {
	Enabled bool `json:"enabled,omitempty"`
	// Cron expression
	Cron  string `json:"cron,omitempty"`
	Every string `json:"every,omitempty"`
	At    string `json:"at,omitempty"`
}

func (ScheduleConfig) String

func (sc ScheduleConfig) String() string

type SubConfig

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

SubConfig sub config info

type WebConfig

type WebConfig struct {
	Host     string
	Port     string
	Username string
	Password string
}

Jump to

Keyboard shortcuts

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