config

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFile added in v0.5.0

func ConfigFile() string

func GistInventoryFile added in v0.5.0

func GistInventoryFile() string

func LockFile added in v0.5.0

func LockFile() string

func LogFile added in v0.5.0

func LogFile() string

func MirrorsStateFile added in v0.5.0

func MirrorsStateFile() string

func ReadConfig added in v0.4.7

func ReadConfig(cfg *Config) error

func ReadToken added in v0.4.7

func ReadToken() (string, error)

func RepositoryInventoryFile added in v0.5.0

func RepositoryInventoryFile() string

func StateDir added in v0.5.0

func StateDir() string

StateDir returns the state directory. Because state location is not configurable, it is hardcoded.

func TempDir added in v0.5.0

func TempDir() string

func TokenFile added in v0.5.0

func TokenFile() string

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() Config

Default returns the default configuration.

func Load

func Load() (*Config, error)

func (*Config) EnsureRuntimeDirectories added in v0.5.0

func (cfg *Config) EnsureRuntimeDirectories() error

EnsureRuntimeDirectories creates all runtime directories required by GitBack.

Missing directories are treated as a recoverable condition. This allows commands such as:

gitback sync

to work even if:

~/.local/share/gitback/mirrors
~/.local/share/gitback/state
~/.local/share/gitback/tmp
~/.local/share/gitback/snapshots

were accidentally removed.

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 int `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