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 ¶
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 ¶
MergeConfig overlays primary over fallback, using fallback values only when the corresponding primary value is unset.
type ConfigMap ¶
ConfigMap is a sectioned configuration map keyed by plugin name (or "core"). Values are YAML-friendly scalars or nested maps/lists.
func LoadConfigFile ¶
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 ¶
MergeConfigMap merges primary over fallback (primary wins).