config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config loads and merges git-ops configuration from environment variables and YAML files.

Config is the legacy typed core configuration used by existing plugins and runtime code. ConfigMap is the newer sectioned representation keyed by plugin name or "core", and is the preferred form for distributing configuration through PluginRegistry.

LoadConfig and LoadConfigMapFromEnv read environment variables into the typed and sectioned forms respectively. LoadConfigFile reads YAML into a ConfigMap. MergeConfig and MergeConfigMap combine higher-priority values over fallbacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Token          string
	Users          []string
	Topics         []string
	TargetDir      string
	Interval       time.Duration
	HookTimeout    time.Duration
	GlobalHooksDir string
	DryRun         bool
	SecretsDir     string // Directory to look for secret files
}

Config is the legacy typed core configuration used by the main runtime and older plugins.

func LoadConfig

func LoadConfig() Config

LoadConfig reads the legacy typed core configuration directly from environment variables.

func LoadConfigFromMap

func LoadConfigFromMap(m map[string]any) Config

LoadConfigFromMap builds a core Config from a map. Supported keys (yaml): token, users, topic, target_dir, interval, hook_timeout, dry_run, global_hooks_dir, secrets_dir.

func MergeConfig

func MergeConfig(primary, fallback Config) Config

MergeConfig overlays primary over fallback, using fallback values only when the corresponding primary value is unset.

type ConfigMap

type ConfigMap map[string]map[string]any

ConfigMap is a sectioned configuration map keyed by plugin name (or "core"). Values are YAML-friendly scalars or nested maps/lists.

func LoadConfigFile

func LoadConfigFile(path string) (ConfigMap, error)

LoadConfigFile loads a YAML config file from disk. Returns an empty map if the file does not exist or is empty.

func LoadConfigMapFromEnv

func LoadConfigMapFromEnv() ConfigMap

LoadConfigMapFromEnv builds a sectioned config map from environment variables. This allows config-file values to override env values without losing defaults.

func MergeConfigMap

func MergeConfigMap(primary, fallback ConfigMap) ConfigMap

MergeConfigMap merges primary over fallback (primary wins).

Jump to

Keyboard shortcuts

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