config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRepository

func AddRepository(repoConfig RepoConfig, configPath string) error

func GetConfigPath added in v0.2.0

func GetConfigPath(configFile string) (string, error)

GetConfigPath returns the config file path, using the provided path if not empty, otherwise returning the default config path

func SaveConfig

func SaveConfig(config *Config, configPath string) error

Types

type Config

type Config struct {
	Global       GlobalConfig `toml:"global"`
	Repositories []RepoConfig `toml:"repositories"`
}

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

type ConfigWatcher

type ConfigWatcher struct {
	// contains filtered or unexported fields
}

ConfigWatcher handles live configuration file watching

func NewConfigWatcher

func NewConfigWatcher(configPath string, onChange func(*Config) error, logger *slog.Logger) (*ConfigWatcher, error)

NewConfigWatcher creates a new ConfigWatcher instance

func (*ConfigWatcher) GetCurrentConfig

func (cw *ConfigWatcher) GetCurrentConfig() *Config

GetCurrentConfig returns the current configuration (thread-safe)

func (*ConfigWatcher) StartWatching

func (cw *ConfigWatcher) StartWatching() error

StartWatching begins watching the config file for changes

func (*ConfigWatcher) StopWatching

func (cw *ConfigWatcher) StopWatching()

StopWatching stops watching the config file

type GlobalConfig

type GlobalConfig struct {
	LogLevel           string `toml:"log_level"`
	DefaultInterval    int    `toml:"default_interval"`
	MaxConcurrentSyncs int    `toml:"max_concurrent_syncs"`

	// History configuration
	HistoryMaxEntries    int    `toml:"history_max_entries"`
	HistoryRetentionDays int    `toml:"history_retention_days"`
	HistoryCacheDir      string `toml:"history_cache_dir"`
	HistoryMaxFileSizeMB int    `toml:"history_max_file_size_mb"`
}

type RepoConfig

type RepoConfig struct {
	Path           string `toml:"path"`
	Enabled        bool   `toml:"enabled"`
	Direction      string `toml:"direction"`
	Interval       int    `toml:"interval"`
	Remote         string `toml:"remote"`
	BranchStrategy string `toml:"branch_strategy"`
	TargetBranch   string `toml:"target_branch,omitempty"`
	SafetyChecks   bool   `toml:"safety_checks"`
	ForcePush      bool   `toml:"force_push"`
}

Jump to

Keyboard shortcuts

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