config

package
v0.0.0-...-ced7c3a Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureLogging

func ConfigureLogging(config *LogConfig) error

ConfigureLogging will take the logging configuration and also adds a few default parameters

Types

type AppConfig

type AppConfig struct {
	Log          LogConfig     `mapstructure:"log"`
	Repositories []*Repository `mapstructure:"repositories" validate:"required,dive"`
}

ResticControllerConfig the collection of all configs

func ReloadConfig

func ReloadConfig(configFile string) (*AppConfig, error)

ReloadConfig (re-)loads and validates the config from the config file

type ForgetPolicy

type ForgetPolicy struct {
	KeepLast    int      `mapstructure:"keep_last"`
	KeepDaily   int      `mapstructure:"keep_daily"`
	KeepHourly  int      `mapstructure:"keep_hourly"`
	KeepWeekly  int      `mapstructure:"keep_weekly"`
	KeepMonthly int      `mapstructure:"keep_monthly"`
	KeepYearly  int      `mapstructure:"keep_yearly"`
	KeepTags    []string `mapstructure:"keep_tags"`
	KeepWithin  string   `mapstructure:"keep_within"`
}

ForgetPolicy specifies to restic retention policy rules

type LogConfig

type LogConfig struct {
	Level string
}

LogConfig specifies all the parameters needed for logging

type Repository

type Repository struct {
	Name           string            `mapstructure:"name" validate:"required"`
	URL            string            `mapstructure:"url" validate:"required"`
	Password       string            `mapstructure:"password" validate:"required_without=PasswordFile"`
	PasswordFile   string            `mapstructure:"password_file" validate:"required_without=Password"`
	EnvFromFile    map[string]string `mapstructure:"env_from_file"`
	Env            map[string]string `mapstructure:"env"`
	AutoInitialize bool              `mapstructure:"auto_initialize"`
	Backup         struct {
		Schedule     string   `mapstructure:"schedule" validate:"required"`
		RunOnStartup bool     `mapstructure:"run_on_startup"`
		IncludeFiles []string `mapstructure:"include_files" validate:"required"`
		ExcludeFiles []string `mapstructure:"exclude_files" validate:"required"`
	} `mapstructure:"backup" validate:"required"`
	IntegrityCheck struct {
		Schedule     string `mapstructure:"schedule" validate:"required"`
		RunOnStartup bool   `mapstructure:"run_on_startup"`
	} `mapstructure:"integrity_check" validate:"required"`
	Retention struct {
		Schedule     string        `mapstructure:"schedule" validate:"required"`
		RunOnStartup bool          `mapstructure:"run_on_startup"`
		Policy       *ForgetPolicy `mapstructure:"policy" validate:"required"`
	} `mapstructure:"retention" validate:"required"`
}

Repository contains the configuration for a restic repository

Jump to

Keyboard shortcuts

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