config

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendManifestV1

type BackendManifestV1 struct {
	Path            string
	Version         int    `mapstructure:"version"`
	Name            string `mapstructure:"name"`
	Description     string `mapstructure:"description"`
	Bin             string `mapstructure:"bin"`
	ProtocolVersion int    `mapstructure:"protocol-version"`
}

func LoadBackendManifests

func LoadBackendManifests(dirs []string) ([]BackendManifestV1, error)

type Config

type Config struct {
	Backends   []BackendManifestV1
	Recipes    []RecipeManifestV1
	MainConfig MainConfig
	Secrets    map[string]string
}

Config describes the entire configuration of `standard-backups` across all config files.

func LoadConfig

func LoadConfig(
	configPath string,
	backendsSearchDirs []string,
	recipesSearchDirs []string,
) (*Config, error)

func (*Config) GetBackendManifest

func (c *Config) GetBackendManifest(name string) (*BackendManifestV1, error)

func (*Config) GetRecipeManifest

func (c *Config) GetRecipeManifest(name string) (*RecipeManifestV1, error)

func (*Config) Validate

func (c *Config) Validate() []ValidationError

type DestinationConfigV1

type DestinationConfigV1 struct {
	Backend        string
	Options        map[string]any
	DefaultVariant string `mapstructure:"default-variant"`
	Variants       map[string]map[string]any
}

type DestinationRef added in v0.5.0

type DestinationRef struct {
	Name    string
	Variant string
}

type HookV1

type HookV1 struct {
	Shell   string `mapstructure:"shell"`
	Command string `mapstructure:"command"`
}

type JobConfigV1

type JobConfigV1 struct {
	Recipe    string
	BackupTo  []string `mapstructure:"backup-to"`
	OnSuccess *HookV1  `mapstructure:"on-success"`
	OnFailure *HookV1  `mapstructure:"on-failure"`
}

type MainConfig

type MainConfig struct {
	Version      int
	Destinations map[string]DestinationConfigV1
	Jobs         map[string]JobConfigV1
	Secrets      map[string]SecretConfigV1
	// contains filtered or unexported fields
}

MainConfig is the configuration file that system administrators are expected to write. In other words, it's `config.yaml`.

func LoadMainConfig

func LoadMainConfig(
	path string,
	backends []BackendManifestV1,
	recipes []RecipeManifestV1,
) (*MainConfig, error)

func (*MainConfig) GetDestination added in v0.5.0

func (c *MainConfig) GetDestination(name string) (*DestinationConfigV1, *DestinationRef, error)

type RecipeManifestV1

type RecipeManifestV1 struct {
	Path        string
	Version     int      `mapstructure:"version"`
	Name        string   `mapstructure:"name"`
	Description string   `mapstructure:"description"`
	Paths       []string `mapstructure:"paths"`
	Exclude     []string `mapstructure:"exclude"`
	Before      *HookV1  `mapstructure:"before"`
	After       *HookV1  `mapstructure:"after"`
}

func LoadRecipeManifests

func LoadRecipeManifests(dirs []string) ([]RecipeManifestV1, error)

type SecretConfigV1

type SecretConfigV1 struct {
	FromFile string `mapstructure:"from-file"`
	Literal  string
}

type ValidationError

type ValidationError struct {
	File      string
	FieldPath string
	Err       error
}

Jump to

Keyboard shortcuts

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