config

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadConfig added in v0.4.7

func ReadConfig(layout runtime.Layout, cfg *Config) error

func ReadToken added in v0.4.7

func ReadToken(layout runtime.Layout) (string, error)

ReadToken reads the GitHub token from env or the layout's token file.

func Write

func Write(path string, cfg Config) error

Write writes the GitBack configuration file.

Types

type Config

type Config struct {
	GitHub   GitHubConfig
	Storage  StorageConfig
	Sync     SyncConfig
	Snapshot SnapshotConfig
	Health   HealthConfig
}

func Default

func Default(layout runtime.Layout) Config

Default returns the default configuration, given a resolved Layout so that default mirror/snapshot paths sit alongside GitBack's other data.

func Load

func Load(layout runtime.Layout) (*Config, error)

Load reads and validates configuration using the given Layout to locate config.toml. It never falls back to defaults — a missing config file is a hard error, since GitBack shouldn't silently run on unconfigured defaults. Run `gitback init` to create one.

func (Config) GistMirrorRoot added in v0.5.4

func (c Config) GistMirrorRoot() string

func (Config) QuarantineDir added in v0.5.4

func (c Config) QuarantineDir() string

func (Config) RepositoryMirrorRoot added in v0.5.4

func (c Config) RepositoryMirrorRoot() string

RepositoryMirrorRoot, GistMirrorRoot, and QuarantineDir are DERIVED from the user-configured MirrorRoot.

func (*Config) Validate

func (c *Config) Validate() error

type GitHubConfig added in v0.5.0

type GitHubConfig struct {
	BackupGists bool `mapstructure:"backup_gists"`
}

type HealthConfig added in v0.5.0

type HealthConfig struct {
	MinimumFreeDiskPercent uint8 `mapstructure:"minimum_free_disk_percent"`
}

type SnapshotConfig added in v0.5.0

type SnapshotConfig struct {
	OutputDirectory string `mapstructure:"output_directory"`
	Retention       int    `mapstructure:"retention"`
}

type StorageConfig added in v0.5.0

type StorageConfig struct {
	MirrorRoot string `mapstructure:"mirror_root"`
}

type SyncConfig added in v0.5.0

type SyncConfig struct {
	Workers       int `mapstructure:"workers"`
	RetryAttempts int `mapstructure:"retry_attempts"`
}

Jump to

Keyboard shortcuts

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